I flush the JG (JsonGenerator) to the file here so that it does not keep it in memory. I'm not sure if it's needed, but it doesn't hurt. The JG should be outputting whatever it is connected to immediately. That has been my experience with it, but if there are concerns I can switch back to an output stream which then writes to the file.