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

From Pavan Deolasee
Subject Re: Memory leak in vac_update_relstats ?
Date
Msg-id 2e78013d0707201044p51ad174v3d55c9d875bba3ba@mail.gmail.com
Whole thread Raw
In response to Re: Memory leak in vac_update_relstats ?  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: Memory leak in vac_update_relstats ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On 7/20/07, Heikki Linnakangas <heikki@enterprisedb.com> wrote:
Pavan Deolasee wrote:
> Are we leaking memory in vac_update_relstats ?
>
> /* Fetch a copy of the tuple to scribble on */
> ctup = SearchSysCacheCopy(RELOID,
>                              ObjectIdGetDatum(relid),
>                              0, 0, 0);
>
> This copy is not subsequently freed in the function.

It's palloc'd in the current memory context, so it's not serious. It'll
be freed at the end of the transaction, if not before that. That's the
beauty of memory contexts; no need to worry about small allocations like
that.

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

Thanks,
Pavan




--
Pavan Deolasee
EnterpriseDB     http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: "Pavan Deolasee"
Date:
Subject: Re: MAXIMUM_ALIGNOF on Windows-32
Next
From: Tom Lane
Date:
Subject: Re: Memory leak in vac_update_relstats ?