> 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
Gevik Babakhani wrote:
> > On backend exit, everything in TopMemoryContext, like all
> > other non-shared memory, is automatically released.
>
> So it is safe to not free the allocated memory in TopMemoryContext and leave
> it to be released on backend exit.
All local memory is safe to handle th
> On backend exit, everything in TopMemoryContext, like all
> other non-shared memory, is automatically released.
>
So it is safe to not free the allocated memory in TopMemoryContext and leave
it to be released on backend exit.
Thank you for the help :)
Regards,
Gevik.
--
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 TopMem
> 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 d
Gevik Babakhani wrote:
I want to keep an array of localized strings in memory.
This array is dynamically allocated and is going to be used between
transactions (that are not necessarily nested).
It must be cleaned/freed when postmaster exists.
In which context should this array be initialized?
Hi,
I want to keep an array of localized strings in memory.
This array is dynamically allocated and is going to be used between
transactions (that are not necessarily nested).
It must be cleaned/freed when postmaster exists.
In which context should this array be initialized? TopMemoryContext pe