To answer a few questions asked by /msg.
It's a twenty-line script called p1.pl that is effectively similar to doing perl -de1 except is loads a few useful modules and accepts multiple lines of input until one is terminated with ;;
See above.
%\:: is (effectively) the symbol table for whole script, including all modules loaded.
When you do total_size( \%:: );;, it is accumulating the sizes of most* the code space, and all of the data space use by everything that makes up the script, inclduing that space used by all modules that are loaded, and some of the code and data space loaded (into every script) by Perl itself.
*See the Devel::Size docs where it explains that the numbers for CVs (code structures) are not complete. Don't expect the accumulated sizes to add up exactly. It gives a good idea of where your script is consuming memory, without being exact.
It will include the space consumed by any variables created by your program (@a in the example) and various other bits and peices including some of the code and data loaded by the Devel::Size module itself, and the various modules ( Carp, Exporter, XSLoader etc. ) that D::S causes to be loaded.
The long list in the Update above, is the results of dumping the keys and total_sizes of %:: individually from within p1.pl, and shows amongst other things that it also loads Data::Dumper, and Benchmark.
It also shows various global structures set up by Perl. Eg.
perl> print ord '↨';; 23
which translates to $^W, and '↑' is 24, $^X which is the name of the script.
In reply to Re^2: Total Memory Size Used up by a Perl Script
by BrowserUk
in thread Total Memory Size Used up by a Perl Script
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |