in reply to Reducing memory usage while matching log entries
I'm wondering what the better way is. :)
Rather than storing the whole file in memory, use a 2 pass solution. In the first pass, gather the locking information. In the second pass, remove the appropriate lines. Each pass will consist of just a while loop that only holds one line at a time in memory.
Update: Another option would be to use Tie::File. It lets you treat the file as if it were an array but manages all of the gory details for you. I just looked at the man page and it has an option to limit the amount of memory it consumes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reducing memory usage while matching log entries
by matt.tovey (Beadle) on Feb 01, 2006 at 16:07 UTC | |
by duff (Parson) on Feb 01, 2006 at 23:08 UTC | |
by matt.tovey (Beadle) on Feb 02, 2006 at 09:00 UTC | |
by salva (Canon) on Feb 02, 2006 at 10:55 UTC |