We don't bite newbies here... much | |
PerlMonks |
Re^3: Getting a memory dumpby BrowserUk (Patriarch) |
on Nov 23, 2007 at 11:49 UTC ( [id://652549]=note: print w/replies, xml ) | Need Help?? |
It is possible I could try running it in Win-XP but it would take quite a bit of setup. Hm. It's possible that the code could be adapted for use on Linux, but I do not have that expertise. The basic idea is that I have a module (Devel::MemWatch) that hooks the DB::DB() interface and pushes the current caller information (package/file/line no) onto a Thread::Queue as each line executes. It has a setable threshhold value above which it discards old information as it pushes new, effectively turning the queue into a circular buffer of the last N lines executed. It also starts a background thread that wakes up every setable N millseconds and queries the process memory size from the system. If the memory expands beyond a setable limit, it dumps the circular buffer to stderr; doubles the memory limit, and goes back to monitoring. The idea is that you get a dump of the last N lines that executed when the memory expanded beyond your preset limit. (And again every time it doubles again). Thus, you can quickly get an idea of what code was executing when the memory started to snowball. The (unbelievably crude but functional) Win32 code looks like this:
Usage is:
Where
The output looks like:
Maybe you can adapt it to your needs? 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.
In Section
Seekers of Perl Wisdom
|
|