http://qs1969.pair.com?node_id=756185

brycen has asked for the wisdom of the Perl Monks concerning the following question:

So I'm tracking a memory leak. Can anyone suggest an easy way to get the current perl memory footprint? I tried Proc::ProcessTable and did not find it easy. I'd just like a count of allocated perl objects, or the total C memory size. Devel::Leak and Devel::Cycle have not worked for me, so I'm brute forcing it, and I'm pretty sure the road leads to DBI. Thanks!

Replies are listed 'Best First'.
Re: Current size of allocated perl memory?
by shmem (Chancellor) on Apr 07, 2009 at 23:58 UTC
    print "current mem: ".`ps -o vsz= -p $$`*1024, $/

    For more accurate information, I'd compile a perl with -DDEBUGGING. See perlrun.

Re: Current size of allocated perl memory?
by almut (Canon) on Apr 07, 2009 at 23:29 UTC
Re: Current size of allocated perl memory?
by brycen (Monk) on Apr 09, 2009 at 16:54 UTC
    I found my memory leak by the way. It is in the C code of DBI's DBD::Pg 1.49 on Debian Etch. It uses the perl memory allocator, and affects BYTEA columns.