Never mind... I found the answer by playing with it. It seems you have to loop thru it a few times for the memory to settle down to a constant value, and since I was using 2 hashes, Perl let it double. However, the following does reclaim memory like I would expect.
#!/usr/bin/perl
use warnings;
use strict;
my %bubs;
while(1){
for(1.. 500){
$bubs{$_} = ZtkBubject->new(
-name => $_,
);
$bubs{$_}=();
delete $bubs{$_};
}
%bubs = ();
undef %bubs;
print "\nCheck memory now and hit enter\n";
<>;
}
#=====================================================================
+========
# ZtkBubject Class
#=====================================================================
+========
package ZtkBubject;
use strict 'vars';
use Carp;
sub new {
my ($class, %arg) = @_;
my $self = {
'name' => $arg{-name},
};
bless $self;
# print "just blessed $self\n";
$self->{stuff} = [1..1000]; #add some memory usage
return $self;
}
#############################################
sub DESTROY{
my ($self) = @_;
print "destroying->", $self->{name},' ',$self,"\n";
}
###########################################
1;
I'm not really a human, but I play one on earth.
flash japh