Re: Patch for fixing a few memory leaks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patch for fixing a few memory leaks
Date
Msg-id 2671.1002235834@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch for fixing a few memory leaks  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Is there some sort of a system behind which places are subject to leaks
> and which places are just too lazy to call pfree()?

> I know that index support procedures must not leak, hmm, I guess this
> would include the function manager...

Yeah, that's basically why there's a problem here --- if this weren't
getting called from the index support area, I don't think the leak would
matter.

> Why aren't index support procedures called with an appropriate memory
> context set up?

I looked at recovering space after index operations but decided it would
take more work than I could invest at the time.  The trouble is that
several of the index AMs allocate space that they expect to stick around
across operations, so they'd have to be fixed to use a special context
for such things.  Eventually it'd be nice to fix it properly, ie, run
index support routines with CurrentMemoryContext = a short-term context,
just as you say.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Patch for fixing a few memory leaks
Next
From: Tatsuo Ishii
Date:
Subject: Re: Problem on AIX with current