Re: hash_destroy on the hash table allocated with TopMemoryContext
| От | Ashutosh Bapat | 
|---|---|
| Тема | Re: hash_destroy on the hash table allocated with TopMemoryContext | 
| Дата | |
| Msg-id | CAExHW5tHffUBWiE17Sec+Fi4WQiWaDs55SF=OaeeFzmLJtOzvA@mail.gmail.com обсуждение исходный текст  | 
		
| Ответ на | hash_destroy on the hash table allocated with TopMemoryContext (Sharique Muhammed <shq78758@gmail.com>) | 
| Список | pgsql-hackers | 
On Wed, Apr 17, 2024 at 1:04 PM Sharique Muhammed <shq78758@gmail.com> wrote:
Hi,I was looking for a pattern to destroy a hashtable (dynahash).allocated in TopMemoryContext
I found one pattern : create_seq_hashtable uses TopMemoryContextmemory context to create hash table. It calls hash_destroy inResetSequenceCaches. hash_destroy will destroy the memory context(TopMemoryContext). Is it the right way to use hash_destroy ?
The context used to pass hash_create() is used to create a child memory context. The hash table is allocated in the child memory context and it's that context which is destoryed by hash_destory(). Isn't it?
I have allocated a hash table in TopMemoryContext context and I wantto destroy it. It seems to me that there is no function to destroy hashtable allocated in TopMemoryContext context.
How did you create hash table in TopMemoryContext? 
--
Best Wishes,
Ashutosh Bapat
В списке pgsql-hackers по дате отправления: