Subject: | Memory leak when dying in freeze hook |
The following program reports an increased refcount after trying to serialize an object which has a freeze hook that dies. Tested under 2.41 and 2.51.
#!/usr/bin/perl
use strict;
use warnings;
use Storable qw( freeze );
use Devel::Refcount qw( refcount );
package TestClass;
sub new {
my $class = shift;
return bless({}, $class);
}
sub STORABLE_freeze {
die;
}
package main;
my $obj = TestClass->new;
print("refcount before: ", refcount($obj), "\n");
eval { freeze($obj); };
print("refcount after: ", refcount($obj), "\n");