Re: C Function Memory Management

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin French <Martin(dot)French(at)romaxtech(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: C Function Memory Management
Date: 2012-12-12 15:29:01
Message-ID: 8510.1355326141@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martin French <Martin(dot)French(at)romaxtech(dot)com> writes:
>> repalloc

> Maybe I should've looked a little harder for that one! Ha Ha!

> I assume it's an exact functional copy of realloc, and see where I get
> with it!

One thing to know about it is that repalloc re-sizes the given chunk
while keeping it in the same memory context it was originally allocated
in (ie, CurrentMemoryContext doesn't matter). This may not matter much
if you're only dealing with allocations that just live as long as the
current function call --- but if you're trying to preserve data across
calls, it's critical to know.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin French 2012-12-12 15:37:55 Re: C Function Memory Management
Previous Message wd 2012-12-12 14:33:44 Re: Looking for cooperators