A colleage said he heard something about a problem with localized hashes within hashes not freeing memory properly. Anyone heard anything about this? The polling subroutine writes everything to a thread localized hash tree and the main loop writes that hash to a file. The code is like this:
All the code is pretty much like that. Collect data in my'd hashes. Then assign that data to the main local'd hash and write out. I checked the symbol table (use Symbol) and %datahash is indeed blank. I even wrote a sub that walked %datahash and manually deleted each key. No difference. I also used the Internals module to check ref counts on the intermediate variables but they're not increasing. My fear here is that there's some stealth "closure" situation going on. Something preventing the lexical data from being garbage collected. Every variable is either my'd or local'd.require Net::SNMP; use Net::DNS; require Digest::MD5; use threads ('stack_size' => 131072); use threads::shared; use Thread::Queue; use Thread::Semaphore; use Data::Dump qw(dump pp); { ## thread entry point for (;;) { local %datahash; ..getdevicetopoll.. &ifpoll($dev); print FILE dump %datahash; } } sub ifpoll { my %devinfo; my %interfaces; ## etc... ..snmp a lot of data here.. %{$datahash{"devinfo"}} = %devinfo; %{$datahash{"interfaces"}} = %interfaces; return; }
Any ideas on what this could be? Any ideas on how to even troubleshoot this? I'm using Solaris 8 and ActiveState Perl 5.8.8 build 817. I've tried build 820 and compiling my own Perl with -DDEBUGGING. No difference.
If anybody has any ideas I'ld be greatly appreciative. Thanks.
In reply to Massive Perl Memory Leak by wagnerc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |