]> granicus.if.org Git - postgresql/commit
Fix memory leak in LogStandbySnapshot().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jun 2013 18:58:57 +0000 (14:58 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jun 2013 18:58:57 +0000 (14:58 -0400)
commitdc12e477eb8a9b502bb613299b9e2b3acd85a4d5
treec9ca28be1600699387e55f2753015a111dba775b
parent89bd9fe5fde46af8e2d93d2cb78a8142ac7caf4d
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