Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: sveta.smirnova [...] oracle.com
Cc: pali [...] cpan.org
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 4.010
  • 4.020
Fixed in: 4.030_01



Subject: memory leak if mysql_server_prepare is enabled
Originally reported by Masahiro Chiba at http://bugs.mysql.com/bug.php?id=41815 Description: DBD::mysql has a memory leak when use "mysql_server_prepare=1". How to repeat: use DBI; my $dbh = DBI->connect('dbi:mysql:mysql_server_prepare=1', 'sandbox', 'sandbox'); my $sth = $dbh->prepare('select 1'); while ( 1 ) { $sth->execute; $sth->fetch; } Suggested fix: because execute many dbd_describe() maybe. It seems resolved this problem when use this patch. --- DBD-mysql-4.010.orig/dbdimp.c 2008-12-29 01:52:26.000000000 +0900 +++ DBD-mysql-4.010/dbdimp.c 2009-01-01 10:26:56.000000000 +0900 @@ -3159,7 +3159,6 @@ /** Store the result in the current statement handle */ DBIc_NUM_FIELDS(imp_sth)= mysql_num_fields(imp_sth->result); DBIc_ACTIVE_on(imp_sth); - imp_sth->done_desc= 0; imp_sth->fetch_done= 0; } }
On Str Feb 20 17:03:44 2013, svetasmirnova wrote: Show quoted text
> Originally reported by Masahiro Chiba at > http://bugs.mysql.com/bug.php?id=41815 > > Description: > DBD::mysql has a memory leak when use "mysql_server_prepare=1". > > How to repeat: > use DBI; > my $dbh = DBI->connect('dbi:mysql:mysql_server_prepare=1', 'sandbox', > 'sandbox'); > my $sth = $dbh->prepare('select 1'); > while ( 1 ) { > $sth->execute; > $sth->fetch; > } > > Suggested fix: > because execute many dbd_describe() maybe. > It seems resolved this problem when use this patch. > > --- DBD-mysql-4.010.orig/dbdimp.c 2008-12-29 01:52:26.000000000 +0900 > +++ DBD-mysql-4.010/dbdimp.c 2009-01-01 10:26:56.000000000 +0900 > @@ -3159,7 +3159,6 @@ > /** Store the result in the current statement handle */ > DBIc_NUM_FIELDS(imp_sth)= mysql_num_fields(imp_sth->result); > DBIc_ACTIVE_on(imp_sth); > - imp_sth->done_desc= 0; > imp_sth->fetch_done= 0; > } > }
Fixed in https://github.com/perl5-dbi/DBD-mysql/commit/1916749c4eec84871cec36392170fba933b12851