Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 53844
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: grig [...] dataart.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 4.013



Subject: [BUG] Memory leak in DBD::mysql
Date: Wed, 20 Jan 2010 19:08:56 +0300
To: "bug-DBD-mysql [...] rt.cpan.org" <bug-DBD-mysql [...] rt.cpan.org>
From: Gregory Burmistrov <grig [...] dataart.com>
Download (untitled) / with headers
text/plain 872b
Hello, I've discovered a bug in DBD::mysql code that leads to memory leak. I have a code that extensively checks $DBH->{mysql_dbd_stats}->{auto_reconnects_ok} variable and perform some queries upon reconnect. The hash structure that is returned by $DBH->{mysql_dbd_stats} is not destroyed after leaving its scope. Here is a simple example: $dbh = DBI->connect($test_dsn, $test_user, $test_password); while (1) { my $tmp=$dbh->{mysql_dbd_stats}; } You can see in top that RES is growing very quickly. I've checked the code with Devel::Peak and finally got a solution that works for me: # diff dbdimp.c.orig dbdimp.c 2274c2274 < result= (newRV_noinc((SV*)hv)); --- Show quoted text
> result= sv_2mortal(newRV_noinc((SV*)hv));
I'm using Fedora Core 8 with distributed Perl (5.8.8) and DBD-mysql-4.012. Thanks for your time and work! Best regards, /grig
Thank you very much for this fix! Will be included in 4.013


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.