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;
}
}