Re: plperl doesn't release memory - Mailing list pgsql-general

From Tom Lane
Subject Re: plperl doesn't release memory
Date
Msg-id 15613.1111620328@sss.pgh.pa.us
Whole thread Raw
In response to plperl doesn't release memory  (Sven Willenberger <sven@dmv.com>)
Responses Re: plperl doesn't release memory
List 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 by date:

Previous
From: Scott Frankel
Date:
Subject: Re: inherited table and rules
Next
From: Vernon
Date:
Subject: Another help needed on Window client