Re: plperl doesn't release memory

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sven Willenberger <sven(at)dmv(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plperl doesn't release memory
Date: 2005-03-23 23:25:28
Message-ID: 15613.1111620328@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sven Willenberger <sven(at)dmv(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vernon 2005-03-24 02:20:37 Another help needed on Window client
Previous Message Scott Frankel 2005-03-23 23:09:45 Re: inherited table and rules