Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

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



Subject: Slow but steady memory leak on last_insert_id calls
Attached is a standalone program to demonstrate the problem. The memory-info printout assumes a linux system (presence of /proc/<pid>/stat) Cheers
Subject: sqlite_leak.pl
use strict; use warnings; use DBI; my $db = 'memleak.db'; unlink $db; my $dbi_dsn = "dbi:SQLite:$db"; my $dbh = init_db(); my $sth = $dbh->prepare_cached ('INSERT INTO test_leak DEFAULT VALUES'); my $count; my $check_insert_id; my $insert_id = 2**32; # pre-allocate variable (no idea if matters) while (1) { $count++; $sth->execute; $insert_id = $dbh->last_insert_id (undef, undef, 'test_leak', 'id') if $check_insert_id; $dbh->do ('DELETE FROM test_leak'); unless ($count % 5000) { unless ($count % 30000) { $check_insert_id = !$check_insert_id; } warn sprintf ("Cycles: %d\tFetching last_insert_id: %s\tProc size: %uK\n", $count, $check_insert_id ? 'Yes' : 'No', (-f "/proc/$$/stat") ? do { local @ARGV="/proc/$$/stat"; (split (/\s/, <>))[22] / 1024 } : -1 , ); } } sub init_db { unlink ($db); my $dbh = DBI->connect ($dbi_dsn, undef, undef, { RaiseError => 1 }); $dbh->do ('PRAGMA SYNCHRONOUS=OFF'); $dbh->do ('DROP TABLE IF EXISTS test_leak'); $dbh->do (<<'EOS'); create table test_leak ( id INTEGER PRIMARY KEY NOT NULL ) EOS return $dbh; }
Thanks for the report. Fixed in the trunk. Kenichi On 2010-8-29 Sun 12:37:03, RIBASUSHI wrote: Show quoted text
> Attached is a standalone program to demonstrate the problem. The > memory-info printout assumes a linux system (presence of /proc/<pid>/
stat) Show quoted text
> > Cheers
Closed this ticket as DBD::SQLite 1.31 with this fix is released. Thanks.