G'day All,

In Judy::HS, the utility function MemUsed() is shown with this very short description:

"Returns the size of a Judy::HS array. This implementation is not supplied by libJudy."

Does anyone know what I'd need to do in order to gain access to MemUsed()?

Alternatively, does anyone know of another method to get the size of a Judy::HS array?

The Perl variable representing the Judy::HS array is just a number: as far as I can tell, it's a pointer used under the hood in XS-land to access the Judy data structure (and way beyond my level of expertise). Modules like Devel::Size just report on the size of the number. Here's a rough summation:

$ perl -E ' use Devel::Size "total_size"; use Devel::Size::Report "report_size"; use Judy::HS qw{Get Set}; my $judy; Set($judy, Key => 42); say q{$judy: }, $judy; say q{total_size($judy): }, total_size($judy); say q{report_size($judy): }, report_size($judy); my ($PValue, $Value) = Get($judy, "Key"); say "\$PValue[$PValue]"; say "\$Value[$Value]"; ' $judy: 42949789440 total_size($judy): 24 report_size($judy): Size report v0.13 for '42949789440': Scalar 24 bytes Total: 24 bytes in 1 elements $PValue[42949813632] $Value[42]

— Ken


In reply to Size of Judy::HS array: where is MemUsed()? by kcott

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.