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 12:47:22 |
Message-ID: | d3c4af540707200547w7d972cb5v3155932212bf6be2@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
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 :).
One specific case I want to mention here is hash_create(). For local hash
tables if HASH_CONTEXT is not specified, they get created in a context which
becomes a direct child of TopMemoryContext. Wouldn't it be a better idea to
create the table in CurrentMemoryContext?
If hash_destroy() is not explicitly invoked, this can cause a lot of bloat
especially if the intention was to use the hash table only for a while.
Regards,
Nikhils
Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Pavan Deolasee | 2007-07-20 12:54:53 | MAXIMUM_ALIGNOF on Windows-32 |
Previous Message | Gregory Stark | 2007-07-20 11:40:46 | Re: CREATE TABLE LIKE INCLUDING INDEXES support |