Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Answer: How do I find the memory used by a particular hash (NOT including perl itself)?

( #51399=categorized answer: print w/ replies, xml ) Need Help??

Q&A > programs and processes > How do I find the memory used by a particular hash (NOT including perl itself)? contributed by ichimunki

Since a whole day went by with no answer to this, I'll give you the best I can do (and hopefully spur some discussion on the topic). If I think memory is going to be a concern with an item in my program, I would build a stop point just before that object was created (something in the application that would wait for the user to hit a key). I would (assuming I'm on linuxunixposix) then run top in a second window and wait for the size of my perl process to stabilize after hitting the stop point. Then going back to the script, continue-- all the while keeping an eye on the top window to see what happens.

This is not an exact method, but it's useful for watching for memory leaks and getting a sense for how much memory your larger structures are eating up. I've only used it to watch my scripts as I built destructors into my Tk applications, but never to actually measure the absolute size of a hash.

Comment on Answer: How do I find the memory used by a particular hash (NOT including perl itself)?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (16)
As of 2014-07-10 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (210 votes), past polls