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

Re: Patch for memory leaks in index scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch for memory leaks in index scan
Date: 2002-04-19 17:54:03
Message-ID: 1801.1019238843@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Dmitry Tkach <dmitry(at)openratings(dot)com> writes:
> *** nodeIndexscan.c.orig        Fri Apr 19 10:29:57 2002
> --- nodeIndexscan.c     Fri Apr 19 10:30:00 2002
> ***************
> *** 505,510 ****
> --- 505,514 ----
>           */
>          ExecClearTuple(scanstate->cstate.cs_ResultTupleSlot);
>          ExecClearTuple(scanstate->css_ScanTupleSlot);
> +       pfree(scanstate);
> +       pfree(indexstate->iss_RelationDescs);
> +       pfree(indexstate->iss_ScanDescs);
> +       pfree(indexstate);
>    }

I do not believe this patch will fix anything.

In general, the EndNode routines do not bother with releasing memory,
because it's the end of the query and we're about to drop or reset
the per-query context anyway.  If the above pfrees are actually needed
then there are a heck of a lot of other places that need explicit
pfrees.  And that is not a path to a solution, because there will
*always* be places that forgot a pfree.  What's needed is a structural
solution.

I think your real complaint is that SQL functions leak memory.  They
should be creating a sub-context for their queries that can be freed
when the function finishes.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-04-19 19:37:59
Subject: Re: Patch for memory leaks in index scan
Previous:From: Dmitry TkachDate: 2002-04-19 17:31:43
Subject: Patch for memory leaks in index scan

pgsql-patches by date

Next:From: Tom LaneDate: 2002-04-19 19:37:59
Subject: Re: Patch for memory leaks in index scan
Previous:From: Dmitry TkachDate: 2002-04-19 17:31:43
Subject: Patch for memory leaks in index scan

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