| From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> | 
|---|---|
| To: | Sharique Muhammed <shq78758(at)gmail(dot)com> | 
| Cc: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: hash_destroy on the hash table allocated with TopMemoryContext | 
| Date: | 2024-04-17 08:42:08 | 
| Message-ID: | CAExHW5tHffUBWiE17Sec+Fi4WQiWaDs55SF=OaeeFzmLJtOzvA@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Wed, Apr 17, 2024 at 1:04 PM Sharique Muhammed <shq78758(at)gmail(dot)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 TopMemoryContext
>  memory context to create hash table. It calls hash_destroy in
>  ResetSequenceCaches. 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 want
> to destroy it. It seems to me that there is no function to destroy hash
> table allocated in TopMemoryContext context.
>
>
How did you create hash table in TopMemoryContext?
-- 
Best Wishes,
Ashutosh Bapat
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2024-04-17 08:52:30 | Re: Solaris tar issues, or other reason why margay fails 010_pg_basebackup? | 
| Previous Message | Alvaro Herrera | 2024-04-17 08:31:52 | Re: ALTER TABLE SET ACCESS METHOD on partitioned tables |