http://www.perlmonks.org?node_id=1065736


in reply to Re: Threads memory consumption
in thread Threads memory consumption

thanks alot ! do you think it will solve my memory consumption problem ?

Replies are listed 'Best First'.
Re^3: Threads memory consumption
by Random_Walk (Prior) on Dec 05, 2013 at 11:21 UTC

    Without seeing more of your code its impossible to tell.

    I have seen multi threaded code eat all the memory when a large shared hash is first built containing all the work to be done, and the threads are then created. In this way each thread gets a copy of the hash, and your memory usage is terrible. Using a queue you use a lot less memory. If however you have some other code in there leaking memory, then changing the way you call threads is unlikely to solve it.

    Are you using strict and warnings? Do you declare all your variables in the smallest possible scope? Can you create a small test version of your code that shows this memory leaking behaviour?

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!