K
Ken DeLong
I'm saving a large amount of data (a video stream: frames of
byte[640*480], 10 fps) to a file. I'm doing it like this:
FileOutputStream fos = new FileOutputStream(fileName);
BufferedOutputStream bos = new BufferedOutputStream(fos);
GZipOutputStream gos = new GZipOutputStream(bos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
.. . .
// on each new frame
oos.writeObject(frame);
This works well with a small number of frames. However, after about
100 frames I get an OutOfMemoryException. I've tried oos.flush()
every 10 frames but it doesn't help.
How can I avoid the memory overflow?
byte[640*480], 10 fps) to a file. I'm doing it like this:
FileOutputStream fos = new FileOutputStream(fileName);
BufferedOutputStream bos = new BufferedOutputStream(fos);
GZipOutputStream gos = new GZipOutputStream(bos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
.. . .
// on each new frame
oos.writeObject(frame);
This works well with a small number of frames. However, after about
100 frames I get an OutOfMemoryException. I've tried oos.flush()
every 10 frames but it doesn't help.
How can I avoid the memory overflow?