"Nigel J. Andrews" <nandrews@investsystems.co.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