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


in reply to Re^4: How can I free the memory of a XML::Simple-Object
in thread How can I free the memory of a XML::Simple-Object

Exist something like that for ActiveState-Perl?

See Devel::Size & Devel::Size::Report which does/can do something similar.

(I also just noticed Devel::SizeMe which I've no knowledge of, but comes from a good author, so would be worth investigating.)

I have to admit that I rarely resort to such tools for tracking memory leaks. Especially if threads are involved; I have my own method.

Basically this involves commenting out the bodies of suspect subroutines/methods -- but having them return plausibly 'good' values -- one at a time until I find which one is contributing to the leak. Then zeroing in from there.

With a program as complex as yours, it could be quite a laborious process, but I find it quicker than wading through reams of dumps. Especially where threads are involved which usually forces you to have to cross-relate data from several threads.

Working out which thread (type) is the cause is often quite easy. Just run an empty(ish) thread procedure for each type -- that again does just enough by way of modifying shared data or returning plausible values to allow the program as a whole to continue to run.

Once you've isolated the thread type involved, then apply the function-by-function mechanism as you would for a single threaded app.

It is actually harder to describe than do.

Good luck. (FV?)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong