[JAVA] JVM memory issues

I just figured out a way of forcing the JVM to allocate the 494Mb in the first turn, when freezes does not matter :

if (turn == 0) {
	FOR_ALLOC = new Board[2000000];
	for (int i = 0; i < 2000000; i++) {
		FOR_ALLOC[i] = new Board();
	}
	FOR_ALLOC = null;
	System.gc();
}

I then have totalMemory = 464Mb. My memory-greedy algorithm that used to freeze after 10 turns now runs like a charm (EDIT2 : false hope guys … It still crashes like crazy, but in a different way. Nevermind.).

EDIT The FAQ says 768Mb btw, you might want to update it :stuck_out_tongue:

4 Likes