Skip Menu |

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

Report information
The Basics
Id: 127546
Status: resolved
Priority: 0/
Queue: CPAN-SQLite

People
Owner: stro [...] cpan.org
Requestors: drrho [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.212
Fixed in:
  • 0.215
  • 0.216



Subject: ENORMOUS memory leak
If you run use CPAN::SQLite; my $obj = CPAN::SQLite->new (...); $obj->index(); several(!) times inside a loop, you will be amazed to have 150MB allocated for a recent cpan package set. For.Each.Run ! Which is not overly surprising given the myriad of references leading back somewhere into the object hash. To make matters worse, the index() method allocates a private index object: my $index = CPAN::SQLite::Index->new .... $index->index(); then fills it, and lets it go out of scope. The toplevel $index will be garbage collected, but not the 10000s of info and obj components trapped inside cycles. On the outside - as a caller - I do never have control over the $index data, so I do not even have a chance to break all the cycles before memory is lost. I would appreciate a response how to approach a fix (weakening info and obj did not fix the issue), or whether it is more wise to think about alternative packages. Thx for your time! rgds, \rho
Hi. I'll take a look into weakening references. Meanwhile, you may want to use CPAN::SQLite::META->new()->reload() instead of CPAN::SQLite->new()->index() similarly to what CPAN shell does. -- Serguei Trouchelle
On Thu Nov 01 23:26:07 2018, STRO wrote: Show quoted text
> Hi. I'll take a look into weakening references.
Much appreciated! Show quoted text
> Meanwhile, you may want to use CPAN::SQLite::META->new()->reload() > instead of CPAN::SQLite->new()->index() similarly to what CPAN shell > does.
Wow. Wow: Works, is memory-friendly and appears to be MUCH faster! This solves the issue for me, at least. :) rgds \rho
Show quoted text
> > Hi. I'll take a look into weakening references.
> > Much appreciated!
The memory leak should be fixed in version 0.215. -- Serguei Trouchelle