in reply to Profiling memory
Within perl, I have in the past written code which walks all package variables in all packages (I did it directly, starting at the %main:: hash, but there's probably a module to make that easier), using Devel::Size::total_size to work out the size of each. This worked well fairly well (sorry - I was unable to release it, but it was a fairly quick hack).
This approach would of course miss any leaked memory (which was no longer rooted in a package var) as well as anything only reachable via a lexical - although that might be fixable with PadWalker. It would also double-count any memory which was reachable via more than one place.
The code basically took a snapshot of all vars and sizes and then gave diffs against it on each subsequent invocation, looking for growing data structures over time.
It was all pure perl and I guess it wouldn't take more than a day or two to recreate from the above description.
|
|---|