[kaffe] OutOfMemoryError

Arne Woerner woerner@mediabase-gmbh.de
Fri, 9 Aug 2002 15:37:49 +0200 (CEST)


Hiho!

I would like to use Kaffe in a productive high-availability environment.
 
I wrote the java application listed in appendix SRC. Then I executed it using
the commands listed in appendix SH. Then I got the output in appendix RT1/RT2
and a file Kaffe.core (size: 268018180 bytes in the case of SH1). By the way:
The Kaffe performance gets rather bad (4% cpu utilization, 96% of time blocked
due to swapping) after the datasize increases to 200% of the physical memory
on my machine...

It does not look so gracefully... I wish that I could catch an
OutOfMemoryError Throwable and do something appropriate (I mean in a real
world application).

The SUN JDK has another problem: It is unwilling to allocate more than free
physical memory (I think the SUN java vm memory cannot be swapped). I wish I
could use a lot of memory (for example the whole virtual memory (4GB or so)).

In a similar setting the executable produced by GCC (version 2.95.3) crashed
the system (OpenBSD 3.1 (GENERIC kernel)). :)

Do you know a solution for my problem (buying more physical memory excluded
:-) ) (the Kaffe version I use is: "Engine: Just-in-time v3   Version: 1.0.6
Java Version: 1.1" (version 1.0.7 does not help, too))? I could try to find
the bug(-s) myself, but I think you will be faster... :-)

Thank you for your time...

Bye
Arne
---
mediaBase GmbH, Maria-Probst-St. 54, 80939 Muenchen, FR Germany
Arne Woerner
phone +49 89 3715977-0 / +49 179 5410106 - fax +49 89 3715977-20

appendix SRC:
	package de.mediabase_gmbh.internal.odbms.vmdb;

	import java.util.Vector;

	public class AllMem {
		public static void main(String args[]) {
			Vector a = new Vector();

			System.out.println("new'ing / add'ing");
			int i = 0;
			for (boolean goon=true; goon; i++) {
				Integer aa[];
				try {
					// filling heap space
					aa = new Integer[1000];
				} catch (Throwable ex) {
					ex.printStackTrace(System.out);
					System.out.println("no more mem "+i);
					goon = false;
					continue;
				}
				// trick out the gc
				a.add(aa);
				if (i%1000 == 0)
					System.out.println(i);
			}

			System.out.println("delete'ing");
			for (int j=0; j<i; j++)
				a.remove(0);

			System.out.println("ready.");
		}
	}

appendix SH1:
	javac AllMem.java && \
		time kaffe -mx 300000000 AllMem | & tee AllMem.java.out

appendix SH2:
	javac AllMem.java && \
		time kaffe -mx 30000000 AllMem | & tee AllMem.java.out

appendix RT1:
	new'ing / add'ing
	0
	1000
	2000
	3000
	4000
	5000
	6000
	7000
	8000
	9000
	10000
	11000
	12000
	13000
	14000
	15000
	16000
	17000
	18000
	19000
	20000
	21000
	22000
	23000
	24000
	25000
	26000
	27000
	28000
	29000
	30000
	31000
	32000
	33000
	34000
	35000
	36000
	37000
	38000
	39000
	40000
	41000
	42000
	43000
	44000
	45000
	46000
	47000
	48000
	49000
	50000
	51000
	52000
	53000
	54000
	55000
	56000
	57000
	58000
	59000
	60000
	61000
	62000
	63000
	64000
	Internal error: caught an unexpected exception.
	Please check your CLASSPATH and your installation.
	java/lang/OutOfMemoryError

appendix RT2:
	new'ing / add'ing
	0
	1000
	2000
	3000
	4000
	5000
	6000
	assertion "sz % gc_pgsize == 0" failed: file "mem/gc-mem.c", line 975
	Abort (core dumped)
		0.312u 0.335s 0:01.77 36.1%     0+0k 31+3278io 0pf+0w