http://www.perlmonks.org?node_id=1001197


in reply to Re^3: How can I free the memory of a XML::Simple-Object
in thread How can I free the memory of a XML::Simple-Object

You are really great :-) By the way. Do you know a good Package for searching memory leaks under Windows XP and perl version 5.8.8. I have memory problems, although I use allways strict.pm (working only with local vars 'me $var') and have no global vars. The program has about 40000 Lines in 100 packages. I would like to have something like the symdump does to produce a list of all variables whose size has changed or are new allocated between two program-positions:
my $memdump = MemoryDump->new(); anyFunction(); print $memdump->diff(MemoryDump->new();

Exist something like that for ActiveState-Perl?

For your example which you've wrote for me: So if I set the size of the array @a

my @a = (); $#a = 1e6;

the memory will be used again

my @a = (); $#a = 1e6; mem(1); $a[ $_ ] = $_ for 1 .. 1e6; mem(2); undef @a; mem(3); my @a = (); $#a = 1e6; $a[ $_ ] = $_ for 1 .. 1e6; mem(4); sub mem { my $mem = `tasklist /nh /fi "PID eq $$"`; $mem =~ tr[ \t\n][ ]s; print "$mem : $_[0]\n"; };