Try flushing the buffer after every write.
The only thing I can think of that's eating up memory here is the outputbuffer. It may not be flushing automatically, causing the JVM to attempt to map the entire output into RAM instead of writing it directly to disk (which you seem to be attempting to do).
Reputation Points: 1658
Solved Threads: 331
duckman
Offline 7,719 posts
since Nov 2004