• Tom Lane's avatar
    Fix memory leak in LogStandbySnapshot(). · dbc6eb1f
    Tom Lane authored
    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.
    dbc6eb1f
lock.c 117 KB