#this is a pure hash, and it works as I expect #!/usr/bin/perl use warnings; use strict; my %bubs; for(1.. 500){ $bubs{$_}{'stuff'} = [1..1000]; print "adding $_\n"; } <>; for(1.. 500){ $bubs{$_}=(); delete $bubs{$_}; print "deleting $_\n"; } <>; for(1.. 500){ $bubs{$_}{'stuff'} = [1..1000]; print "adding $_\n"; } for(1.. 500){ $bubs{$_}=(); delete $bubs{$_}; print "deleting $_\n"; } <>; __END__ #################################### # this is with objects, where it dosn't # reuse a DESTROYED objects space even though I # stuff them into the same hash space #!/usr/bin/perl use warnings; use strict; my %bubs; for(1.. 500){ $bubs{$_} = ZtkBubject->new( -name => $_, ); $bubs{$_}->DESTROY; delete $bubs{$_}; $bubs{$_}=(); } <>; for(1.. 500){ $bubs{$_} = ZtkBubject->new( -name => $_, ); $bubs{$_}->DESTROY; } <>; #============================================================================= # ZtkBubject Class #============================================================================= package ZtkBubject; use strict 'vars'; use Carp; sub new { my ($class, %arg) = @_; # object attributes my $self = { 'name' => $arg{-name}, #identifying name }; bless $self; # print "just blessed $self\n"; $self->{self} = $self; $self->{stuff} = [1..1000]; #add some memory usage return $self; } ############################################# sub DESTROY{ my ($self) = @_; print "destroying->", $self->{name},' ',$self,"\n"; } ########################################### 1; __END__