in reply to Massive Perl Memory Leak
100 threads taking up 2 Gb is "only" 20 Mb per thread. the thread-local data in %datahash alone could account for that. As noted above, you should not count on perl sharing any data between threads (not even internally) unless you explicitly arrange for that. In other words, perl threads behave much more like separate processes than most other thread implementations do.
It's easy enough to check if that's the problem: reduce the number of threads. If the amount of memory taken is stable relative to the number of threads there probably isn't a leak, you're just suffering from perl's memory-hungry approach to problem solving.
update: I just want to note that using threads in this program doesn't seem to be necessary (assuming you're using threads to run multiple SNMP connections in parallel). It's perfectly possible (and probably more efficient) to do that in a single thread. For instance, you could use non-blocking IO and select() instead. I believe that Net::SNMP even provides a callback/non-blocking interface. See also POE::Component::SNMP.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Massive Perl Memory Leak
by wagnerc (Sexton) on Jun 12, 2007 at 19:11 UTC | |
by BrowserUk (Patriarch) on Jun 12, 2007 at 20:03 UTC | |
by wagnerc (Sexton) on Jun 12, 2007 at 21:16 UTC | |
by chromatic (Archbishop) on Jun 12, 2007 at 21:50 UTC | |
by wagnerc (Sexton) on Jun 12, 2007 at 22:06 UTC | |
| |
by ysth (Canon) on Jun 12, 2007 at 22:25 UTC |