Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the DBM-Deep CPAN distribution.

Report information
The Basics
Id: 94291
Status: new
Priority: 0/
Queue: DBM-Deep

People
Owner: Nobody in particular
Requestors: terris [...] terris.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Memory leak when leaving 'each' loop prematurely
Date: Fri, 28 Mar 2014 15:15:15 -0700
To: bug-DBM-Deep [...] rt.cpan.org
From: Terris Linenbach <terris [...] terris.com>
Download (untitled) / with headers
text/plain 829b
Hello, Thanks for DBM::Deep! It's very useful. use DBM::Deep; my %db; tie %db, "DBM::Deep", "foo.db"; $db{ 'a' } = { 'b' => { } }; untie %db; for ( ;; ) { tie %db, "DBM::Deep", "foo.db"; my $hash = $db{'a'}; while ( each %{$hash} ) { last; } untie %db; } If you comment out the 'last' in the while loop, the leak will disappear. I also tied the next_key API. That didn't fix the problem. I tried many things - e.g., weaken, calling keys on the 'a' hash, using OO instead of tie, closing via stuff like "tied %db->engine->close" and on and on (I spent several days working on alternatives). The only thing that fixes the leak is to use "each" all the way to the end of the hash prior to untie. This isn't a special case. For me, it happens to every hash stored in DBM::Deep. Thanks, Terris


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.