Re: SRF memory leaks

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: SRF memory leaks
Дата
Msg-id 1204144136.14838.35.camel@dell.linuxdev.us.dell.com
обсуждение исходный текст
Ответ на Re: SRF memory leaks  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: SRF memory leaks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
On Wed, 2008-02-27 at 15:07 -0500, Tom Lane wrote:
> Negative refcount does not prove that the SRF itself hasn't
> still got a pointer to the tupdesc.

That sounds quite bizarre. The SRF has already finished execution at
this point, so keeping a pointer to the tupledesc around would only make
sense if you wanted to use that tupledesc on a *subsequent* invocation
of the SRF. The SRF would need to store the pointer in a static
variable, too, and it wouldn't have an easy way to distinguish between
repeated calls to the SRF within the same query and in different queries
(since in the latter case the TupleDesc will be long gone anyway). I
can't see why anyone would want to do this.

> Can't we fix it so that the tupdesc is allocated in the new special
> context (at least in the primary code paths), and then no explicit
> free is needed?

As I said earlier, the tupdesc is explicitly allocated in the per-query
context by the SRFs themselves. If by "primary code paths", you mean
"SRFs in the main source tree", then sure, we can make arbitrary changes
to those. That won't help out-of-tree SRFs though.

-Neil



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SRF memory leaks
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: DTrace probe patch for OS X Leopard