On Thu, Jun 12, 2014 at 9:25 AM, Zoffix Znet via RT
<bug-Devel-MemoryTrace-Light@rt.cpan.org> wrote:
Show quoted text> Thu Jun 12 09:25:28 2014: Request 96403 was acted upon.
> Transaction: Ticket created by ZOFFIX
> Queue: Devel-MemoryTrace-Light
> Subject: Doesn't seem to report everything
> Broken in: 0.09
> Severity: (no value)
> Owner: Nobody
> Requestors: cpan@zoffix.com
> Status: new
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=96403 >
>
>
> The module doesn't seem to report memory increases inside main files (as opposed to loaded modules).
>
> A sample output looks like this (abridged):
>>> 12634 init, 0 (0) used 5111808 bytes
>>> 12634 CGI, ../ds3_site/CPAN/CGI.pm (869) used 651264 bytes
>>> 12634 DynaLoader, /usr/lib/perl/5.14/DynaLoader.pm (37) used 163840 bytes
>>> 12634 strict, /usr/share/perl/5.14/strict.pm (29) used 262144 bytes
>>> 12634 strict, /usr/share/perl/5.14/strict.pm (36) used 270336 bytes
>>> 12634 vars, /usr/share/perl/5.14/vars.pm (35) used 270336 bytes
>>> 12634 DynaLoader, /usr/share/perl/5.14/XSLoader.pm (71) used 28672 bytes
>>> 12634 Symbol, /usr/share/perl/5.14/Symbol.pm (3) used 262144 bytes
>>> 12634 DynaLoader, /usr/share/perl/5.14/XSLoader.pm (71) used 77824 bytes
>>> 12634 MIME::Lite, /home/zoffix/perl5/lib/perl5/MIME/Lite.pm (508) used 532480 bytes
>>> 12634 strict, /usr/share/perl/5.14/strict.pm (29) used 270336 bytes
>
> If I try out the example shown in the docs, I get no output at all.
>
The way Perl is grabbing memory can be different depending on compile
time options and other factors. It often will pre-allocate much more
memory than what you need, and later when you do something that you
think *will* get more memory, but is actually pulling from the already
allocated pool.
Also, this module will only show when your program actually grows in
size, and it's entirely possible that your program releases memory
back to the OS, and so this module might not see changes until it goes
beyond what it's last recorded for the highest amount of used memory.
It's imprecise, and can be useful in certain situations, but you may
find that it's not helpful for yours.
I don't think there's a bug here, but if you'd like to show me the
code in question (or perhaps see if you don't get a report on ex.pl
with a number much higher than 4096, like 40096), I can look into it
more.
(Be careful with going too high on that number though, or you may
start swapping).
-- Matthew Horsfall (alh)