|Think about Loose Coupling|
I ran your code (after a little clean-up) out to:
And I verified the real memory usage as '1776MB' constant. I verified this with 'top' and with:
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.
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