Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Memory issue with Hash

by flexvault (Parson)
on Dec 04, 2012 at 14:24 UTC ( #1007095=note: print w/ replies, xml ) Need Help??


in reply to Memory issue with Hash

nowise,

I ran your code (after a little clean-up) out to:

Record counter => 335700
And I verified the real memory usage as '1776MB' constant. I verified this with 'top' and with:
'/bin/ps -o rssize -p $$'
I used the latest Debian Linux 2.6.32 distribution and used perl 5.12.2 for the test. I did not use 'Proc::ProcessTable', so I can't say whether that is part of your problem. I also deleted the 'sleep( 10 );' since I didn't see any value in waiting 10 seconds to see the screen fill up immediately again.

Some suggestions:

  • perl5.8.8 is rather old.
  • use strict and use warnings ( You need more 'my's in your code
  • Consider using a 'log' file for incrementing information.

From this test, your problem isn't the hash growing. It could be your system or the system's perl that's giving you the problem.

Good Luck!

Update: I remembered I had some AIX systems with perl5.8.8 and I ran the code to 'Record counter => 10320' and the memory usage stayed as '1940MB'. So it doesn't seem to be a problem on the AIX perl5.8.8 either

Update2: My "MB" in above should be "KB" as the way 'top' and 'ps' return the information.

"Well done is better than well said." - Benjamin Franklin


Comment on Re: Memory issue with Hash
Select or Download Code
Re^2: Memory issue with Hash
by nowise (Initiate) on Dec 05, 2012 at 10:36 UTC

    i donot know how the system or perl is giving the error.

    can you please provide some more details on it.

    i had read somewhere that perl should be compiled with the "usemymalloc=y" compiler flag to release the memory.

    when i ran the perl -V on the commandline i could see this flag set to "y".

    Also the only contributing factor to increase in the process memory , seems to be because of hash.

    please see below the memory increase in the process ,it remain constant to some point , and then gaian start increasing :

    Record counter => 20 Process Status:6.328125MB Record counter => 30 Process Status:6.4296875MB Record counter => 40 Process Status:6.4375MB Record counter => 50 Process Status:6.4375MB Record counter => 60 Process Status:6.4453125MB Record counter => 70 Process Status:6.4453125MB Record counter => 80 Process Status:6.4453125MB Record counter => 90 Process Status:6.453125MB Record counter => 100 Process Status:6.453125MB Record counter => 110 Process Status:6.453125MB Record counter => 120 Process Status:6.453125MB Record counter => 130 Process Status:6.4609375MB

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-11-27 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (178 votes), past polls