Re: Memory leak in vac_update_relstats ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Memory leak in vac_update_relstats ?
Date
Msg-id 11932.1184955537@sss.pgh.pa.us
Whole thread Raw
In response to Re: Memory leak in vac_update_relstats ?  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
Responses Re: Memory leak in vac_update_relstats ?  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
"Pavan Deolasee" <pavan.deolasee@gmail.com> writes:
> On 7/20/07, Heikki Linnakangas <heikki@enterprisedb.com> wrote:
>> It's palloc'd in the current memory context, so it's not serious.

> Right. But may be for code completeness, we should add that
> missing heap_freetuple.

Personally I've been thinking of mounting an effort to get rid of
unnecessary pfree's wherever possible.  Particularly in user-defined
functions, "cleaning up" at the end is a waste of code space and
cycles too, because they're typically called in contexts that are
going to be reset immediately afterward.

In the case of vac_update_relstats, it's called only once per
transaction, so there's certainly no point in being a neatnik.
Stuff you need to worry about is functions that might be called
many times in the same memory context.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Pavan Deolasee"
Date:
Subject: Re: Memory leak in vac_update_relstats ?
Next
From: Gregory Stark
Date:
Subject: Re: Memory leak in vac_update_relstats ?