Re: Which MemoryContext? - Mailing list pgsql-hackers

From Gevik Babakhani
Subject Re: Which MemoryContext?
Date
Msg-id 001601c87416$06dc9100$0a01a8c0@gevmus
Whole thread Raw
In response to Re: Which MemoryContext?  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Responses Re: Which MemoryContext?  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
List pgsql-hackers
> TopMemoryContext sounds right. Be careful not to leak there.

Thank you :)

I have allocated memory using: MemoryContextAlloc(TopMemoryContext,n *
sizeof(char*));
In pgsql/src/backend/utils/mmgr/README:142 is stated that memory allocated
using above should be freed manually, Is this correct? Or does the system
release everything allocated in TopMemoryContext automatically when exiting?

I looked around and found examples where memory allocated 
using above is not freed! (datetime.c:3811,   uhhh.. a bit confused here)

Any thoughts?

Regards,
Gevik.





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Getting available options
Next
From: Aidan Van Dyk
Date:
Subject: Re: Permanent settings