plpgsql function seems to be leaking memory

Поиск
Список
Период
Сортировка
От Marc Cousin
Тема plpgsql function seems to be leaking memory
Дата
Msg-id 200806241056.29589.mcousin@sigma.fr
обсуждение исходный текст
Ответы Re: plpgsql function seems to be leaking memory  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Hi,

I'm having a problem with plpgsql functions leaking memory.

I've reproduced the problem with this simple function here :

CREATE OR REPLACE FUNCTION ftest()
  RETURNS boolean AS
$BODY$BEGIN
INSERT INTO test2 values (1);
RETURN true;
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


test2 table is a one column table

CREATE TABLE test2
(
  id integer
)
WITH (OIDS=FALSE);



Then to see the leak, I've called it repeatedly with a perl program :

#!/usr/bin/perl -w
#
#
use DBI;
$dbh = DBI->connect("dbi:Pg:dbname=test","postgres");

my $statement = 'SELECT ftest ()';
$sth = $dbh->prepare($statement);
$dbh->begin_work();
for ($i=0;$i<1000000;$i++)
{
        $sth->execute();
}
$dbh->rollback();


I see the postgresql process growing from 8MB to about 400 MB during this
run...

It only seems to happen when a function contains an insert statement (I don't
see leaks when only selecting).



logs=# SELECT version();
                                      version
------------------------------------------------------------------------------------
 PostgreSQL 8.3.3 on x86_64-pc-linux-gnu, compiled by GCC cc (Debian 4.3.1-1)
4.3.1
(1 row)




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

Предыдущее
От: "P Kapat"
Дата:
Сообщение: Re: adding a user library path..
Следующее
От: "C K"
Дата:
Сообщение: Functions