kcott has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|