8000 Fix small query-lifespan memory leak in bulk updates. · patchsoft/postgres@46bd14a · GitHub
[go: up one dir, main page]

Skip to content

Commit 46bd14a

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 25fe5f7 commit 46bd14a

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
@@ -3579,6 +3579,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
35793579
ReleaseBuffer(vmbuffer);
35803580
bms_free(hot_attrs);
35813581
bms_free(key_attrs);
3582+
bms_free(id_attrs);
35823583
return result;
35833584
}
35843585

@@ -4031,6 +4032,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
40314032

40324033
bms_free(hot_attrs);
40334034
bms_free(key_attrs);
4035+
bms_free(id_attrs);
40344036

40354037
return HeapTupleMayBeUpdated;
40364038
}

0 commit comments

Comments
 (0)
0