Re: plperl doesn't release memory

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plperl doesn't release memory
Дата
Msg-id 15613.1111620328@sss.pgh.pa.us
обсуждение исходный текст
Ответ на plperl doesn't release memory  (Sven Willenberger <sven@dmv.com>)
Ответы Re: plperl doesn't release memory  (Sven Willenberger <sven@dmv.com>)
Список pgsql-general
Sven Willenberger <sven@dmv.com> writes:
> I have been experiencing an issue with plperl and PostgreSQL 8.0.1 in
> that after calling a plperl function memory does not get released.

AFAICT the result of spi_exec_query gets released fine, as soon as it's
no longer referenced within perl.  Perhaps your perl code is written in
such a way that a reference to the hash result value remains live after
the function exit?

I tried this:

create or replace function nrows(text) returns int as $$
  my ($tabname) = @_;
  my $rv = spi_exec_query("select * from $tabname");
  return $rv->{processed};
$$ LANGUAGE plperl;

and ran it repeatedly against a large table.  The memory usage went
up as expected, but back down again as soon as the function exited.

If you think it's actually a plperl bug, please show a self-contained
example.

            regards, tom lane

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

Предыдущее
От: Scott Frankel
Дата:
Сообщение: Re: inherited table and rules
Следующее
От: Vernon
Дата:
Сообщение: Another help needed on Window client