On 7/17/06, Ephraim Dan <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."

Reply via email to