perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Blythe <>
Subject DBD::mysql memory leak!
Date Fri, 02 Feb 2001 00:55:15 GMT
I have been testing and troubleshooting this for days, and I can find no
other answer to my problem except that DBD::mysql has a memory leak.

I have narrowed it down to this small script running through

use DBI;
use DBD::mysql;
use strict;

print "Content-type: text/plain\n\n";

my $dbh = DBI->connect("dbi:mysql:db;host=localhost", "user", "pass")
   or die "no DB!\n";

my $sth = $dbh->prepare(q{
   select * from junk where id = 10

$sth->execute() or die "no sql\n";
while (my @row = $sth->fetchrow_array())
   print join("\n", @row), "\n";


This script runs just fine, and displays the contents of the single
specified MySQL row.  However, if I watch the size of my httpd process, it
will grow over time as I access the script repeatedly.

I use the following script to load test it:

use LWP::Simple `get`; 
$uri = shift; 
$hits = 0; 
$SIG{INT} = sub { print "fetched: $hits"; exit }; 
while(1) { 
    get $uri or die "get failed!"; 

I am using the latest DBD::mysql module, as far as I can tell.  I forced a
reinstall with CPAN shell, just to be sure.  Here is my version info:

Embedded Perl version v5.6.0 for Apache/1.3.12 (Unix) mod_perl/1.24

As common as this mod_perl/DBD/MySQL combination is, SOMEBODY else has to
have had this same trouble and solved it.  Right? ... Right?


Mark Blythe

P.S.  I've used Apache::Leak and Apache::Status to no avail.

View raw message