Do be aware that Devel::Size
does count shared data in part of its size calculation when figuring out how big what you're checking is, but it only counts it once per call, so if the two hashes share some data, and they might, pass them in together for a correct aggregate total. Something like:
print total_size([\%hash1, \%hash2]);
though that'll add in a few dozen bytes for the two refs and the anon array.
Also, don't rule out the possibility that there's a lot of scrap memory hanging around that Perl's not cleaned up after quite yet, or that you've not noticed.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.