possible leak in 1.52



Hi.

I'm running 1.52 and I may have found a leak ( i found a discussion reported on the 1.51 branch, and a patch to 1.52, so i think this might be different )

I was profiling some mod_perl code for unexplained growth with Devel::Leak, and came across a growth of 1 reference count with every call to $dbh->prepare ( also to $dbh->do , but it seems to just wrap prepare ).

the growth seems to happen regardless of parameters supplied to do / prepare

my $handle;
my $count= Devel::Leak::NoteSV($handle);
=snip
my $query= $dbh->prepare( 'SELECT id FROM my_table' );
=snip
print STDERR "\n Count before: " . $count;
print STDERR "\n ------------------------------------------";
my $count_after= Devel::Leak::CheckSV($handle);
print STDERR "\n Count after: " . $count_after;
print STDERR "\n Leaked: " . ( $count_after - $count );

If i comment out the do/prepares, I have no leaks in reference counts.

Now , i'm using DBD::Pg with this, and it very well could be an issue with that driver and not the DBI. unfortunately, I can't install any other DB on my machines to test.

I haven't been able to trace things within DBI , as I'm not that familiar with it.

Off a fresh apache start, a call to the DBD prepare will cause a growth of ~10 references, then ~5, and then 1 per request. Between this and some other things online, I kind of think that it might have to do with DBI's caching of the statement. I couldn't find that in the code though.
.



Relevant Pages

  • Re: memory leak in DBI XS bootstrap code
    ... The file called INSTALL in the perl source code directory. ... I don't believe that's a leak. ... without telling perl its a reference. ... memory leak in DBI XS bootstrap code ...
    (perl.dbi.users)
  • Fed Cuts Key Rate 25 BPs to 2% ; Pause Now Likely
    ... promote moderate growth over time," the Fed said. ... officials dropped their previous reference to downside growth ... inflation risks were roughly balanced. ...
    (misc.invest.stocks)
  • Re: Class Loading
    ... minor performance worries are winning over leak issues. ... A common use of thread-locals is to have them as a static references, referencing a instance of a class loaded by the same class-loader. ... If there is little ThreadLocal turnover in a thread and the values reference large amounts of memory, then there can be problems as the implementation is quite lazy about removing entries. ... There is strongly referenced value of a ThreadLocal via the entry of its customized hash map which is strongly referenced by Thread instance. ...
    (comp.lang.java.programmer)
  • Re: Memory leak or expected behavior?
    ... >each web page bump the memory out, and as we know it's not given back ... My experience with objects 'leaking' memory (not a true leak, ... In Tk you need to reuse objects, because it keeps a reference to ... photo objects to handle what will be on-screen at any one time. ...
    (comp.lang.perl.misc)
  • Re: memory leak in DBI XS bootstrap code
    ... I just ran valgrind with your fix - there seems to still be a leak. ... The trick is to use newSV to alloc memory in the form of an SV ... >> The file called INSTALL in the perl source code directory. ... without telling perl its a reference. ...
    (perl.dbi.users)