CC: | k [...] sawada.cc |
Subject: | memory leak in DBD::Pg-1.43_1 |
Date: | Mon, 16 Jan 2006 23:03:43 +0900 (JST) |
To: | bug-dbd-pg [...] rt.cpan.org |
From: | Kenichi Sawada <k [...] sawada.cc> |
hi,
i've just found a subtle memory leak in DBD::Pg-1.43_1
here's the code to reproduce the leak:
#/path/to/perl
use DBI;
for(;;) {
my $dbh = DBI->connect("DBI:Pg:dbname=template1","postgres","");
$dbh->disconnect;
}
and i think this patch may be useful to avoid this leak:
*** dbdimp.c.old 2006-01-16 22:47:21.000000000 +0900
--- dbdimp.c 2006-01-16 22:52:28.000000000 +0900
***************
*** 581,586 ****
--- 581,587 ----
if (dbis->debug >= 4) { (void)PerlIO_printf(DBILOGFP, "dbdpg: dbd_db_des
troy\n"); }
av_undef(imp_dbh->savepoints);
+ sv_free((SV*)imp_dbh->savepoints);
Safefree(imp_dbh->sqlstate);
if (DBIc_ACTIVE(imp_dbh)!=0)
i'm not sure this is the correct way to avoid this problem..
thanks,
----
Kenichi Sawada
k@sawada.cc