Re: Memory leak in vac_update_relstats ?

From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory leak in vac_update_relstats ?
Date: 2007-07-20 10:17:46
Message-ID: d3c4af540707200317n25b26ef1if3e364680dcd60b4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

>
> 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.

That's the beauty of memory contexts for small allocations. But because of
the 'convenience' of memory contexts we sometimes tend to not pay attention
to doing explicit pfrees. As a general rule I think allocations in
TopMemoryContext should be critically examined. I was bitten by this undue
bloat recently while developing some code and valgrind is not of much help
in such cases because of this very beauty of memory contexts :).

Regards,
Nikhils

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-07-20 11:40:46 Re: CREATE TABLE LIKE INCLUDING INDEXES support
Previous Message Heikki Linnakangas 2007-07-20 09:36:14 Re: Memory leak in vac_update_relstats ?