Re: Memory leak in nodeAgg

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Memory leak in nodeAgg
Date: 2008-03-12 01:35:08
Message-ID: 200803120135.m2C1Z8N13944@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Added to TODO:

* Consider simplifying how memory context resets handle child contexts

http://archives.postgresql.org/pgsql-patches/2007-08/msg00067.php

---------------------------------------------------------------------------

Neil Conway wrote:
> On Mon, 2007-08-06 at 18:52 -0400, Tom Lane wrote:
> > Hmm. Good catch, but I can't help wondering if this is just the tip
> > of the iceberg. Should *every* MemoryContextReset be
> > MemoryContextResetAndDeleteChildren?
>
> Yeah, the same thought occurred to me. Certainly having the current
> behavior as the default is error-prone: it's quite easy to leak child
> contexts on Reset. Perhaps we could redefine Reset to mean
> ResetAndDeleteChildren, and add another name for the current Reset
> functionality. ResetAndPreserveChildren, maybe?
>
> > If we redefined MemoryContextReset to be the same as
> > MemoryContextResetAndDeleteChildren, it'd be possible to keep the
> > headers for child contexts in their parent context, thus easing
> > traffic in TopMemoryContext, and perhaps saving a few pfree cycles
> > when resetting the parent
>
> The fact that MemoryContextCreate allocates the context header in
> TopMemoryContext has always made me uneasy, so getting rid of that would
> be nice. I wonder if there's not at least *one* place that depends on
> the current Reset behavior, though...
>
> > Anyone want to investigate what happens if we make MemoryContextReset
> > the same as MemoryContextResetAndDeleteChildren?
>
> Sure, I'll take a look, but I'll apply the attached patch in the mean
> time (above cleanup is probably 8.4 material anyway).
>
> -Neil
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-12 02:06:59 Re: Configurable Penalty Costs for Levenshtein
Previous Message Tom Lane 2008-03-12 00:34:17 Re: Proposed patch for LISTEN/NOTIFY race condition