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

From Heikki Linnakangas
Subject Re: Memory leak in vac_update_relstats ?
Date
Msg-id 46A0820E.1000407@enterprisedb.com
Whole thread Raw
In response to Memory leak in vac_update_relstats ?  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
Responses Re: Memory leak in vac_update_relstats ?  (NikhilS <nikkhils@gmail.com>)
Re: Memory leak in vac_update_relstats ?  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
List pgsql-hackers
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.

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

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