in reply to Taming a memory hog

If the output record can be produced by reading one line of input, I am wondering why you decided to read the whole file into memory?

This remind me of something. At work, when I inspected some C code I noticed that the person is closing
and re-opening the file on every write. When I asked him why, he said "when I ran the program, it did not write
anything to the output file for few minutes and when I closed and opened it, I was able to see the output right away!