Skip Menu |

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

Report information
The Basics
Id: 37215
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

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



Subject: memory leaks in sqlite_db_disconnect
DBD::SQLite leaks memory in sqlite_db_disconnect. Follow is a recurrence code. This code leaks memory in each loop. use strict; use warnings; use DBI; while (1) { my $dbh = DBI->connect('dbi:SQLite:dbname=/tmp/foo.sqlite', undef, undef, {AutoCommit => 1, RaiseError => 1}) or die $DBI::errstr; $dbh->disconnect; } I think av_undef does not free the memory. follow is a patch. === dbdimp.c ================================================================== --- dbdimp.c (revision 21926) +++ dbdimp.c (local) @@ -157,9 +157,11 @@ imp_dbh->db = NULL; av_undef(imp_dbh->functions); + SvREFCNT_dec(imp_dbh->functions); imp_dbh->functions = (AV *)NULL; av_undef(imp_dbh->aggregates); + SvREFCNT_dec(imp_dbh->aggregates); imp_dbh->aggregates = (AV *)NULL; return TRUE;
Confirming this patch has been applied.