Skip to content

Commit ae4760d

Browse files
committed
Fix small query-lifespan memory leak in bulk updates.
When there is an identifiable REPLICA IDENTITY index on the target table, heap_update leaks the id_attrs bitmapset. That's not many bytes, but it adds up over enough rows, since the code typically runs in a query-lifespan context. Bug introduced in commit e55704d, which did a rather poor job of cloning the existing use-pattern for RelationGetIndexAttrBitmap(). Per bug #14293 from Zhou Digoal. Back-patch to 9.4 where the bug was introduced. Report: <20160824114320.15676.45171@wrigleys.postgresql.org>
1 parent ca9cb94 commit ae4760d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
38023802
ReleaseBuffer(vmbuffer);
38033803
bms_free(hot_attrs);
38043804
bms_free(key_attrs);
3805+
bms_free(id_attrs);
38053806
return result;
38063807
}
38073808

@@ -4268,6 +4269,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
42684269

42694270
bms_free(hot_attrs);
42704271
bms_free(key_attrs);
4272+
bms_free(id_attrs);
42714273

42724274
return HeapTupleMayBeUpdated;
42734275
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy