object never destructs
On Sun, 13 Jul 1997 11:20:24 EDT, Andrew Pimlott wrote:
>package mytest;
>sub DESTROY { warn "Death"; }
>package main;
>{
> my $joe;
> my $moe;
> $moe = bless \$joe, 'mytest';
> print "Leaving block\n";
>}
>print "Left block\n";
Thanks for that excellent test case. Perl optimizes the
memory management of lexicals by not actually deallocating
unreferenced lexicals when the block exits, in order to
reuse them when the block is reentered. This of course
fails to destruct objects at the end of blocks.
A patch that fixes the problem for all object datatypes
is attached.
p5p-msgid:
199707131955.PAA29655@aatma.engin.umich.edu