Commit ae4760d6 authored by Tom Lane's avatar Tom Lane

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 e55704d8, 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>
parent ca9cb940
...@@ -3802,6 +3802,7 @@ l2: ...@@ -3802,6 +3802,7 @@ l2:
ReleaseBuffer(vmbuffer); ReleaseBuffer(vmbuffer);
bms_free(hot_attrs); bms_free(hot_attrs);
bms_free(key_attrs); bms_free(key_attrs);
bms_free(id_attrs);
return result; return result;
} }
...@@ -4268,6 +4269,7 @@ l2: ...@@ -4268,6 +4269,7 @@ l2:
bms_free(hot_attrs); bms_free(hot_attrs);
bms_free(key_attrs); bms_free(key_attrs);
bms_free(id_attrs);
return HeapTupleMayBeUpdated; return HeapTupleMayBeUpdated;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment