Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Data structure Memory Usage

by arunhorne (Pilgrim)
on May 21, 2003 at 09:55 UTC ( #259678=perlquestion: print w/ replies, xml ) Need Help??
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

Comment on Data structure Memory Usage
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://259678]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2015-05-23 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (465 votes), past polls