Re: Relevance of ChildHandles

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On Tue, May 07, 2013 at 10:28:29PM +0100, Alberto Simões wrote:
>    Hello
> 
>    Any kind of handle on DBI has a $h->{ChildHandles} that store weakrefs to all child handles created. For
>    instance, on a $dbh, you will get a list of weakrefs to $sth you create.
> 
>    When one of those $sth gets out of scope, its count get to 0. What Perl does to the weakref, is to
>    change it to an undef value (Perl isn't able to remove that element from the array).
> 
>    Although a single undef takes less memory than a complete $sth object, it takes memory space. And if we
>    get a lot of these undef values, things get worse.

The DBI purges undef entries from ChildHandles from time to time.
(Specifically whenever the number of entries is a multiple of 120.)

At this stage in the life of the DBI I think it's reasonable to assume
that there isn't a leak in the DBI itself. If there was then a lot of
people would be affected and complaining about it.

Tim.
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.