Skip site navigation (1) Skip section navigation (2)

Memory leak on hashed agg rescan

From: "Neil Conway" <neil(dot)conway(at)gmail(dot)com>
To: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Memory leak on hashed agg rescan
Date: 2008-10-16 02:18:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I noticed a minor leak in the per-query context when ExecReScanAgg()
is called for a hashed aggregate. During rescan, build_hash_table() is
called to create a new empty hash table in the aggcontext. However,
build_hash_table() also constructs the "hash_needed" column list in
the per-query context, so repeated calls of build_hash_table() result
in leaking this memory for the duration of the query.

Attached is a patch that fixes this by only constructing "hash_needed"
if it doesn't already exist. I also bms_free'd the temporary BMS that
is created, although that's pretty harmless.


Attachment: hashed_agg_mem_leak-1.patch
Description: application/octet-stream (2.4 KB)


pgsql-hackers by date

Next:From: Robert HaasDate: 2008-10-16 02:33:31
Subject: Re: array_agg (was Re: The Axe list)
Previous:From: ITAGAKI TakahiroDate: 2008-10-16 01:34:05
Subject: Re: Annoying error messages in _dosmaperr

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group