When I have this problem, it usually is a global variable that continues to grow. In some cases, I use a subroutine that I call every so many seconds to show the memory status of the variables. Something like this (Note: I did this from memory so it may not compile asis).
You may want to add the actual memory location to the log. I have learned the hard way that the variable that I think I'm clearing may be the wrong one. To get the memory address:sub ShowGrowth { use Devel::Size qw(total_size); our ( $BigScalar, %BigHash, @BigArray ); my $nokeys = keys ( %BigHash ); my $noitems = $#BigArray; print $DLOG "####### Devel::Size #########\n"; print $DLOG "\$BigScalar: ",total_size(\$BigScalar),"\n"; print $DLOG "\%BigHash: ",total_size(\%BigHash)," No of keys: $no +keys\n"; print $DLOG "\@BigArray: ",total_size(\@BigArray), " No of element +s: $noitems\n"; }
Leaking memory problems are never easy to find, but this code may give you some ideas on how to find the problem.print $DLOG "\$BigScalar: ",total_size(\$BigScalar)," Addr: ",\$Bi +gScalar,"\n";
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
In reply to Re: Memory usage of array and hashe variables by multiple inclusion.
by flexvault
in thread Memory usage of array and hashe variables by multiple inclusion.
by tobias_hofer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |