MySQL Forums
Forum List  »  Perl

memory leak in 32-bit DBD::mysql on a 64-bit Linux host
Posted by: Igor Marnat
Date: January 14, 2008 06:16AM

Hi All!
I have binary proprietary 32-bit Perl module that I forced to use, therefore I use 32-bit Perl interpreter. I also have server with 32 Gigabyte of RAM, therefore I use 64-bit Linux (openSUSE 10.3) (platform x86_64).

In order to connect to MySQL server, I need DBD::mysql driver. It isn't included in perl-32bit*, so I built it manually.

It seems to work but after a few days of usage we found that there are memory leaks. We generated test script (attached) and I can see using top that its size in memory grows constantly. I tried to run it under valgrind and it shows also memory leaks.

By the way, I tried to build and install DBD::mysql from sources using CPAN, but this attempt failed. CPAN loaded the sources, saw that current perl interpreter is 32-bit one and tried to run Makefile.PL with parameter "C_FLAGS=-m32". Makemaker doesn't want to run with it and complains that "'C_FLAGS' is not a known MakeMaker parameter name".

Therefore I downloaded DBD::mysql sources and built it manyally. If this matters, I can write configuration parameters I used to build it.

MySQL server is of 5.0.45 version, DBD::mysql is of 4.005 version.

Please help, what can we do in order to avoid memory leaks? Any help or idea, please.

If I run this script using 64-bit perl interpreter (/usr/bin/perl), it works ok and its size remain the same all the time. If I remove DBD::mysql usage from the script, it works ok as well. Therefore I suppose that the problem is somewhere in DBD::mysql driver.

Test script:

#!/opt/ActivePerl-5.8/bin/perl -w

use strict;
use DBI;


my $CONSTR = "dbi:mysql:billing:";
my $LOGIN = "log";
my $PASSWORD ="pas";



my $date_agr = "2007-11-11";
my $ip_int = 1234567;
my $sql_str = "SELECT CLIENT_ID, XLS_NAME FROM clients WHERE IP_INT = $ip_int AND FROM_DATE<='".$date_agr."' AND TO_DATE>'".$date_agr."'";

for (my $j=1; $j<99999999; $j++)
my $sth = $DBH_MAIN->prepare($sql_str);
#print $j;


Options: ReplyQuote

Written By
memory leak in 32-bit DBD::mysql on a 64-bit Linux host
January 14, 2008 06:16AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.