Fix a gradual memory leak in ExecReScanAgg(). Because the aggregation
authorNeil Conway <neilc@samurai.com>
Wed, 8 Aug 2007 18:06:55 +0000 (18:06 +0000)
committerNeil Conway <neilc@samurai.com>
Wed, 8 Aug 2007 18:06:55 +0000 (18:06 +0000)
commit8a4b4bdf6905b32b0fffab00d0c1c84d3786d9d4
tree035231b26d0c405fcbea22822946a668516e064a
parentb753ef04cfe2dc5193af4a4e551248eb92098390
Fix a gradual memory leak in ExecReScanAgg(). Because the aggregation
hash table is allocated in a child context of the agg node's memory
context, MemoryContextReset() will reset but *not* delete the child
context. Since ExecReScanAgg() proceeds to build a new hash table
from scratch (in a new sub-context), this results in leaking the
header for the previous memory context. Therefore, use
MemoryContextResetAndDeleteChildren() instead.

Credit: My colleague Sailesh Krishnamurthy at Truviso for isolating
the cause of the leak.
src/backend/executor/nodeAgg.c