in reply to Re^3: Getting a memory dump
in thread Getting a memory dump

This looked like a useful idea but I have been unable to get it work for me yet.

Adopting the calls for getProcessMemoryInfo on Linux was easy enough. Something like:

open(PID, "/proc/$$/statm"); return (split(' ', <PID>))[5] * 4;

but I found that the overhead of handling every statement with DB::DB was far too high. I tried to adjust the script to use DB::sub and just record subroutine calls.

I need to include something in my DB::sub function that handles the recursion caused by the calls to $Q->pending etc. but so far I have failed to come up with a mechanism that both breaks the recursion and actually keeps on executing. Any suggestions would be appreciated.

my $handling = 0; sub DB::sub { return &$DB::sub if $handling; $handling = 1; scalar $Q->dequeue if $Q->pending > $OPTS{ LINES }; $Q->enqueue( $DB::sub ); $handling = 0; return &$DB::sub; }

Replies are listed 'Best First'.
Re^5: Getting a memory dump
by BrowserUk (Patriarch) on Nov 26, 2007 at 09:04 UTC

    See this blog entry by Jonathan T. Rockway which shows his progress on the exact same problems you've encountered. He's gone much further than I have with this and his code snippets shoudl be useful to you.

    I have a few ideas myself also. I'll post again if I get anything useful.


    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.