I added some testing routines in a prog I have, and added code to disable them unless I select the tests from the command line.
if (DEBUG_ENABLED) { ... 54 lines of somewhat dense code (1.7k chars). }

What I want to find out is if disabling it really reduces memory size. FWIW, DEBUG_ENABLED is optimized to a constant, so theoretically, perl should be able to throw away anything in the braces and I should see a smaller package size. Am trying to find out if theory matches reality. :-)

The memory routines I've seen don't seem to allow inspecting the size of a package, especially w/r/t breaking down:
code 47.5KB
data 30KB

Of course ideally it would be something like this FF extension (showing memory related to this page):
(about:memory shows the usage for the entire browser, and the detail view shows that sources are stored where in memory).

│ ├──19.49 MB (04.40%) -- top(http://perlmonks.org/?node=Seekers of Perl Wisdom, id=9)
│ │ ├──12.25 MB (02.77%) -- cached
│ │ │ ├───6.31 MB (01.42%) -- window(http://perlmonks.org/?node_id=6364;user=438862)
│ │ │ │ ├──5.44 MB (01.23%) -- layout
│ │ │ │ │ ├──4.94 MB (01.12%) ── style-sets
│ │ │ │ │ └──0.51 MB (00.11%) ++ (6 tiny)
│ │ │ │ └──0.86 MB (00.20%) ++ (4 tiny)
│ │ │ └───5.95 MB (01.34%) -- window(http://perlmonks.org/?node_id=438862)
│ │ │ ├──5.26 MB (01.19%) -- layout
│ │ │ │ ├──4.94 MB (01.12%) ── style-sets
│ │ │ │ └──0.33 MB (00.07%) ++ (6 tiny)
│ │ │ └──0.68 MB (00.15%) ++ (4 tiny)
│ │ ├───6.71 MB (01.52%) -- active/window(http://perlmonks.org/?node=Seekers of Perl Wisdom)
│ │ │ ├──5.76 MB (01.30%) -- layout
│ │ │ │ ├──4.94 MB (01.12%) ── style-sets
│ │ │ │ └──0.82 MB (00.19%) ++ (6 tiny)
│ │ │ └──0.95 MB (00.22%) ++ (4 tiny)
│ │ └───0.52 MB (00.12%) ++ js-zone(0x1c187000)
│ ├──11.51 MB (02.60%) -- top(none)
│ │ ├───7.24 MB (01.63%) -- ghost
│ │ │ ├──4.78 MB (01.08%) -- window(https://log.perl.org/2018/05/goodbye-search-dot-cpan-dot-org.html)
│ │ │ │ ├──4.78 MB (01.08%) ++ js-compartment(https://log.perl.org/2018/05/goodbye-search-dot-cpan-dot-org.html)
│ │ │ │ └──0.00 MB (00.00%) ++ dom
│ │ │ └──2.46 MB (00.56%) ++ window(https://log.perl.org/2018/03/goodbye-bitcard.html#comment-form)
│ │ └───4.27 MB (00.96%) ++ detached/window(system)

Anyway, just the code amount is really what I'm interested in, since there aren't any permanent vars in that section, the other vars should just be on the stack.

Seems like there are several related to showing data sizes, and there fairly good tools for measuring cpu usage, but not so much when it comes to code usage...

Ideals? Suggestions?


In reply to way to find module memory usage? by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.