Subject: | thawing a truncated value leaks memory |
Attempting to thaw a serialized object which has been truncated causes a memory leak. It seems that the parts of the object which have already been constructed are not cleaned up when the retrieve operation fails. I've attached a short script which demonstrates the problem.
Details:
Storable 2.06 and 2.08
perl 5.8.0
redhat 9
use strict;
use warnings;
use Storable qw( freeze thaw );
use Devel::Leak;
my @x = (1 .. 100);
my $frozen = freeze(\@x);
thaw($frozen);
$frozen = substr($frozen, 0, length($frozen)/2);
my $handle;
Devel::Leak::NoteSV($handle);
thaw($frozen) or print "thaw failed\n";
Devel::Leak::CheckSV($handle);