|There's more than one way to do things|
ithreads memory leakby DNAb (Novice)
|on Apr 08, 2015 at 03:38 UTC ( #1122762=perlquestion: print w/replies, xml )||Need Help??|
DNAb has asked for the wisdom of the Perl Monks concerning the following question:
I'm puzzled by something that seems simple, but yet is yielding strange results. I'm using threading as part of a decent sized program, the easiest way to describe the purpose of this code is it's part of an alarm system.
What I'm running into is a memory leak when using ithreads, sleep, and detach. This doesn't seem to happen if I use join to wait for the thread to finish execution, but I can't do this because the main loop has to keep running.
Here is a short snippet of code that exhibits the issue, the modules are in there for two reasons, one being it shows the leak better, two being these are what are used in the production code.
I'm using PERL 5.20.2, compiled using perlbrew. I'm using top and ps to watch memory usage on a Linux server. Type "start" a few times and the memory usage balloons about 6MB each time. At random points the ballooning stops, and PERL will reclaim seemingly about 1MB of memory, then start ballooning again.
What am I missing here?
Back to Seekers of Perl Wisdom