Re: Potential dbi memory leak.

Steve Cookson <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Hi Tim,

Sorry to prolong this.

On 28/05/15 08:58, Tim Bunce wrote:
> When a new handle is created the DBI simply pushes a weak reference to 
> the handle onto the end of the ChildHandles array. Because it's a weak 
> reference it doesn't interfere with the handle getting destroyed when 
> the last (non weak) reference is removed. When the handle is 
> destroyed, the corresponding element in the ChildHandles array is set 
> to undef by the weak reference mechanism deep in the perl internals.

The issue I have is that I do have real memory leaks in other parts of 
my system and this caching makes it hard to detect where the real leaks are.

I have tried to suppress the caching using this code:

     $loc_sth->finish();
     #
     print Dumper( $DBI::lasth );
     $DBI::lasth ->{ChildHandles} = []; # <-- reset leaking data structure
     delete $DBI::lasth ->{ChildHandles};

But I have not managed to stop it.  In order to clarify my real leaks, 
how can I suppress the dbi caching for the duration of my tests?

Thanks,

Steve.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.