arunhorne has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

How can I find out how much memory my datastructure is using up, e.g. if I have:

my %struct = ("key1" => ["bill","ben"], "key2" => ["dave","jen"]);

Is the some function I can pass a reference, \%struct to to find out the memory usage?

Thanks,

____________
Arun

Replies are listed 'Best First'.
Re: Data structure Memory Usage
by broquaint (Abbot) on May 21, 2003 at 09:58 UTC
    How can I find out how much memory my datastructure is using up
    Use Elian's marvellous Devel::Size e.g
    use Devel::Size 'total_size'; my %struct = ("key1" => ["bill","ben"], "key2" => ["dave","jen"]); print "total size of %struct - ", total_size(\%struct); __output__ total size of %struct - 412
    See. Devel::Size for more info.
    HTH

    _________
    broquaint