Re: memory leak in DBI ...

Re: memory leak in DBI ...

am 19.07.2006 03:02:44 von jonathan.leffler

------=_Part_48071_9948741.1153270964276
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 7/17/06, Ephraim Dan wrote:

> Can someone else try to reproduce a memory leak in a simple
> connect/prepare/execute/disconnect loop using DBI 1.51 and any DBD driver?
>


I created a test program using the test harness distributed with
DBD::Informix and found a small but gentle leak. Over a period of multiple
thousand connections, the Perl executable grew from 866 KB to 973 KB, and
showed no signs of stopping. Is that what you were looking for? (In an
Informix database, the Systables system catalog table is always present.)

This was tested with DBI 1.50 on Solaris 8 (and Perl 5.8.7 - I won't bore
you with why it wasn't 5.8.8). I upgraded to DBI 1.51 (same DBD::Informix
2005.02) and got the same basic result, with Perl growing from 869 to 903
over 2000 iterations.

#!/bin/perl -w
#
# Memory leak test per Ephraim Dan

use strict;
use DBD::Informix::TestHarness;

my $conn_count = 0;

sub test_connection
{
$conn_count++;
my $dbh = &connect_to_test_database({ AutoCommit => 0, RaiseError => 1,
PrintError => 1 });
my $sth = $dbh->prepare("SELECT * FROM Systables");
$sth->execute;
$dbh->disconnect;
}

sub test_subroutine
{
while (1)
{
test_connection;
print "Connections: $conn_count\n" if ($conn_count % 1000 == 0);
}
}

memory_leak_test(\&test_subroutine);
exit;

--
Jonathan Leffler #include
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."

------=_Part_48071_9948741.1153270964276--