This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
readObject memory consumption
- From: Nicolás Ernesto Kuzminski <nkuzminski at gmail dot com>
- To: java at gcc dot gnu dot org
- Date: Tue, 30 Nov 2004 16:49:27 -0300
- Subject: readObject memory consumption
- Reply-to: Nicolás Ernesto Kuzminski <nkuzminski at gmail dot com>
I'm using the 4.0 Windows port downloaded from
http://www.thisiscool.com/gcc_mingw.htm. It has been very useful for
me, since the libjcj in 4.0 is way more complete than the one on the
current releases. And I'm also using SWT and other things that works
out of the box on this special release.
But now I'm facing this issue, wich I don't know if it happens on the
current snapshots. Really, I've tried a bit to build the snapshots,
and failed. I lack the experience to do it.
So, here it is. The problem is the big memory consumption that the
readObject part of the following testcase shows (Just see it on the
Task Manager). This is a very much simplified situation than the one
I'm working on, but is enough to show the problem. Any ideas?
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class prueba {
public static void main(String[] args) throws Exception {
String filename = "bla";
System.out.println("Out");
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream(filename));
for (int i=0;i<1000000;i++) {
out.writeObject(new String());
out.reset();
}
out.close();
System.out.println("In");
ObjectInputStream in = new ObjectInputStream(new FileInputStream(filename));
try {
while (true)
System.out.print(in.readObject());
} catch (Exception e) {}
in.close();
}
}
--
Saludos, Nico.