Re: Memory management question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Memory management question
Дата
Msg-id 5267.1031060472@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Memory management question  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Список pgsql-hackers
"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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: findoidjoins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: possible vacuum improvement?