Re: Which MemoryContext?
От | Heikki Linnakangas |
---|---|
Тема | Re: Which MemoryContext? |
Дата | |
Msg-id | 47BCBC0E.4070603@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: Which MemoryContext? ("Gevik Babakhani" <pgdev@xs4all.nl>) |
Ответы |
Re: Which MemoryContext?
|
Список | pgsql-hackers |
Gevik Babakhani wrote: > 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? On backend exit, everything in TopMemoryContext, like all other non-shared memory, is automatically released. > I looked around and found examples where memory allocated > using above is not freed! (datetime.c:3811, uhhh.. a bit confused here) That palloc'd table in datetime.c is kept until backend exit, or until it's replaced with a new table. If it's replaced with a new table, the old one is explicitly pfree'd in that function: > /* Now safe to replace existing table (if any) */ > if (timezonetktbl) > pfree(timezonetktbl); -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: