Subject: | memory leak in CDS locking routines |
Date: | Thu, 07 Nov 2013 16:06:00 -0500 |
To: | bug-BerkeleyDB [...] rt.cpan.org |
From: | David Mansfield <david [...] cobite.com> |
I've finally tracked down a leak which has bothered me for years!
In the package BerkeleyDB::CDS::Lock (in BerkeleyDB.pm), there are two
"global" hashes, %Object and %Count.
These hashes are keyed by the stringification of the $db object.
Entries in these hashes are never deleted, even when the $db object is
long gone.
This only matters if new $db are being created and destroyed. In my
long-running perl daemon, the leak only really becomes significant after
months!
Some kind of:
delete $BerkeleyDB::CDS::Lock::Count{"$db"};
delete $BerkeleyDB::CDS::Lock::Object{"$db"};
is needed, probably when the Count hits 0.
--
Thanks,
David Mansfield
Cobite, INC.