in reply to Big file, system no likey ..
Changing the for loop to a while loop should help.
update:arturo++ for catching my laziness in explaination
should probably explain, why this is. If you use a for loop, you end up pulling in all the lines in the file in one fell swoop (creating the list for the loop), and then iterating over them, which as you have noticed okay for smaller files, but with larger files you are using a lot of memory, and for even larger files, a lot more than memory still, well you get the picture.
On the other hand with the while loop you are only reading in one line at a time, so you don't have to have the huge file in memory all at once.
-enlil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Big file, system no likey ..
by Anonymous Monk on Jun 19, 2003 at 13:51 UTC |