[DBD-SQLite] DBD::SQLite causing memory leak, after upgrade to v1.31..

Toby Corkindale toby.corkindale at strategicdata.com.au
Sun Nov 28 23:47:13 GMT 2010

On 23/11/10 17:20, Tee Shuwn Yuan wrote:
> hi all,
> I am currently doing development under Perl 5.8.8, with SQLite3 version 3.3.8.
> I need to run a perl script that will takes few days to be completed&  I use
> DBI and DBD::SQLite to store something into sqlite3 database.
> In my perl script, it has 10 child process running concurrently. However, I
> noticed a slow memory leak, and eventually after like 12 hours, the script
> die with "out of memory". I suspected it is due to DBD::SQLite&  apparently
> it is.
>  From this link:  http://kobesearch.cpan.org/htdocs/DBD-SQLite/Changes.html
> I read this:
>> 1.30_06 Thu 9 Sep 2010
>>     * Resolved # 60860: Slow but steady memory leak on last_insert_id calls
> In my script, I did use the method "last_insert_id". So I guess it is the
> problem causing the memory leak.

Maybe it is.. or maybe there is another problem with your code?

Have you tried using tools such as Devel::Leak or even just the GTop 
module to analyse your memory usage?

> However, I upgraded the DBD::SQLite to version 1.31 (the latest) and rerun my
> perl script, the leak problem still persist. Until I restart my machine, the
> leak problem has gone away.
> My question is, is that true the upgrading of DBD::SQLite cpan module require
> a system restart to takes affect? Because I can always restart in my
> development environment, but not on live server environment that is already
> running. What can I do for the changes to take effect without rebooting the
> whole system?

That is untrue. You can upgrade CPAN modules without needing to reboot.

I would make sure that your Perl script is getting the latest version of 
the module - maybe you didn't upgrade it correctly on the server?

May I suggest that you put the required version number against the line 
using it in your script? You do that by writing, for example:

#!/usr/bin/env perl
use strict;
use warnings;
use DBI;
use DBD::SQLite 1.31;

That way, if the version is less than 1.31, your perl script will exit 
with an error message.

I hope this helps,

More information about the DBD-SQLite mailing list