Subject: | BDB::mysql connect memory leak |
Originally reported by Carlos Velasco at
http://bugs.mysql.com/bug.php?id=66859
Description:
DBD::mysql leaks memory when using connect
Seems related to bug #60531 but I am seeing this with good password.
How to repeat:
Perl is 5.16.1
DBD::mysql is 4.022
DBI is 1.622
mysql is mysql-5.5.27.tar.gz
Use this perl script:
#!/usr/bin/perl
use Devel::Leak;
use DBI;
use DBD::mysql;
my $DLcount;
my $DLhandle;
my $con;
my $con = DBI->connect('DBI:mysql:database=test;host=127.0.0.1', 'root',
'', {PrintError => 0,PrintWarn=>0});
$DLcount = Devel::Leak::NoteSV($DLhandle);
print "PRE 1 count: $DLcount\n";
undef $con;
$con = DBI->connect('DBI:mysql:database=test;host=127.0.0.1', 'root',
'', {PrintError => 0,PrintWarn=>0});
$DLcount = Devel::Leak::NoteSV($DLhandle);
print "POST 1 count: $DLcount\n";
$DLcount = Devel::Leak::NoteSV($DLhandle);
print "PRE 2 count: $DLcount\n";
undef $con;
$con = DBI->connect('DBI:mysql:database=test;host=127.0.0.1', 'root',
'', {PrintError => 0,PrintWarn=>0});
$DLcount = Devel::Leak::CheckSV($DLhandle);
print "POST 2 count: $DLcount\n";
Output shows:
# perl test.pl
PRE 1 count: 12777
POST 1 count: 12778
PRE 2 count: 12778
new 0x7cce08 : SV = NULL(0x0) at 0x7cce08
REFCNT = 1
FLAGS = (PADSTALE,PADMY)
new 0x743250 : SV = PVAV(0x8f38e8) at 0x743250
REFCNT = 1
FLAGS = (PADSTALE,PADMY)
ARRAY = 0x0
FILL = -1
MAX = -1
ARYLEN = 0x0
FLAGS = (REAL)
new 0x743b98 : SV = NULL(0x0) at 0x743b98
REFCNT = 1
FLAGS = (PADSTALE,PADMY)
old (1):
0 SV = UNKNOWN(0xff) (0x743b80) at 0x7435c8
REFCNT = 0
FLAGS = ()
old (1):
0 SV = UNKNOWN(0xff) (0x7435c8) at 0x7430a0
REFCNT = 0
FLAGS = ()
POST 2 count: 12779
[18 Sep 15:39] Carlos Velasco
But DBD::mysql leaks test shows ok
# SLOW_TESTS=1 make test
PERL_DL_NONLAZY=1 /usr/bin/perl-64 "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.t .................. ok
...
t/60leaks.t ................. ok
[18 Sep 16:00] Sveta Smirnova
This is not duplicate of bug #60531
[18 Sep 18:12] Carlos Velasco
It seems this problem has been there for long long ago:
https://bugs.launchpad.net/ubuntu/+source/libdbd-mysql-perl/+bug/51746