]> granicus.if.org Git - postgresql/commit
Fix memory leak in LogStandbySnapshot().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jun 2013 18:59:02 +0000 (14:59 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jun 2013 18:59:02 +0000 (14:59 -0400)
commitc28bfb35ef6ce9e9d82da00008554d0fc9c4a7fc
tree21edf572e6f3c6cf28f8ba31e899552159b71507
parentbb5a21746bf0f764c5af9245bc845443d51f4a94
Fix memory leak in LogStandbySnapshot().

The array allocated by GetRunningTransactionLocks() needs to be pfree'd
when we're done with it.  Otherwise we leak some memory during each
checkpoint, if wal_level = hot_standby.  This manifests as memory bloat
in the checkpointer process, or in bgwriter in versions before we made
the checkpointer separate.

Reported and fixed by Naoya Anzai.  Back-patch to 9.0 where the issue
was introduced.

In passing, improve comments for GetRunningTransactionLocks(), and add
an Assert that we didn't overrun the palloc'd array.
src/backend/storage/ipc/standby.c
src/backend/storage/lmgr/lock.c