in reply to Force perl to release memory back to the operating system
In your case however, you are trying to fix your problem in the wrong way. There's no need to slurp in all the data in memory, if only you want to keep track of the top 30.
Here's an outline of a better algorithm:
Read in the first 30 records, sort them. Then process the other records one by one. If the record is larger than the smallest of the 30 records so far, remove the smallest, and add the newests (keep it in order).
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Force perl to release memory back to the operating system
by Anonymous Monk on Sep 25, 2003 at 16:42 UTC |