Re: Which MemoryContext? - Mailing list pgsql-hackers

From Gevik Babakhani
Subject Re: Which MemoryContext?
Date
Msg-id 004801c87460$7358eff0$0a01a8c0@gevmus
Whole thread Raw
In response to Re: Which MemoryContext?  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
> All local memory is safe to handle that way.  
In my case I am reallocating memory for a global variable between
transactions. I wanted to make sure I don't leave allocated memory behind.

> The problem only arises when you have memory to release _earlier_ than
that.
First I was looking for a way to free my allocated memory before exit. I
found the proc_exit hook mechanism but I am not sure where to setup this
hook.

Given allocating memory in TopMemoryContext is the same as malloc, then I'll
just leave my allocated memory to be freed automatically when exit.

Thank you :)

Regards,
Gevik 







pgsql-hackers by date:

Previous
From: "Peter Childs"
Date:
Subject: Re: Permanent settings
Next
From: Gregory Stark
Date:
Subject: Re: VARATT_EXTERNAL_GET_POINTER is not quite there yet