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.
- 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.
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||