Re: Memory management question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Memory management question
Date: 2002-09-03 13:41:12
Message-ID: 5267.1031060472@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Nigel J. Andrews" <nandrews(at)investsystems(dot)co(dot)uk> writes:
> It's probably a pretty basic question explained in some document I
> haven't seen but...if I do something like a CreateTupleDescCopy() how
> do I know my memory context owns everything allocated without
> following the code all the way through until it returns to me?

If it doesn't, then it's broken. A general rule of the system is that
structures being allocated for return to a routine's caller must be
allocated in the caller's CurrentMemoryContext. The only exceptions are
for cases where the routine in question is taking responsibility for the
long-term management of the object (for example, a syscache) --- in
which case, it isn't your problem.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-09-03 13:49:54 Re: possible vacuum improvement?
Previous Message Tom Lane 2002-09-03 13:21:33 Re: findoidjoins