Subject: | Memory leak if an array is appear in bind-variables. |
In attache You can find a test that showes the problem.
It leaks 1 or 2 Mb / second on my system.
If You comment $dbh->do string it will work without any leaks.
Subject: | leak_pg1.t |
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect('dbi:Pg:dbname=Database;host=localhost',
login => 'XXXX');
$dbh->do('CREATE TEMPORARY TABLE tbl (id SERIAL PRIMARY KEY, val INTEGER[])');
our $cnt;
sub _flush_data
{
my ($array) = @_;
my $sql = sprintf "INSERT INTO tbl (val) VALUES %s",
join ",", map '(?)', @$array;
$dbh->do($sql, undef, @$array);
printf "saved: %d\n", scalar @$array;
}
while(1) {
my @ary;
push @ary, [ 0 .. int rand 10] for 0 .. int rand 50;
_flush_data(\@ary);
}