Le mardi 19 février 2013 à 12:05 +0100, Jan Strube a écrit : > Hi, > > we have a Java daemon that´s repeatedly calling a Perl function inside > our database (version 9.1.8). The function is called about 200 times per > second. While the Java program is running you can watch the memory usage > of the postmaster grow continuously until after a few hours we get an > out of memory error from Postgres. In the log you see a lot of > "ExprContext..." messages. When the daemon is killed the memory is > freed.The daemon is using a single database connection during it´s runtime. > > You can see the function definition here: > http://www.deriva.de/tmp/get_comment.txt > > Does anyone have an idea what could be wrong here or how I can find out > where the memory is spend? > Not sure, but have you considered closures? I wonder if your use of %data in $get_value = sub {...} is creating one. See Merlyn's reply in this thread : http://www.gossamer-threads.com/lists/modperl/modperl/27667?search_string=closure;#27667 for a way to find out. If so, you can probably do my $get_value = sub { my ($data, $table, $cond, $field) = @_; (where $data is a reference to %data) ... } and call it with my $value = $get_value->(\%data, $1, $2, $3); instead of my $value = $get_value->($1, $2, $3); -- Salutations, Vincent Veyron http://marica.fr/site/demonstration Progiciel de gestion des sinistres assurance et des dossiers contentieux pour le service juridique -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general