in reply to Memory consumption with

perl does not give memory back to the operating system (see perldoc perlfaq3 for more on this), so the memory consumption of the process will not shrink during its execution time. It does however reuse memory which it has claimed and freed internally. So if you start another 50 threads after the first 50 have ended you should not see the memory consumption of your process go up significantly (provided you are not keeping a reference to an old data structure around somewhere).

Update: as Fletch has said, using separate processes instead of threads will achieve the desired effect, because the operating system reclaims memory from processes that have ended.


Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan