You too can tune your Java applications’ GC performance to total perfection! How can you do this?
Using jvmstat, the most useful GC tool ever!
It displays graphically the amount of memory the eden, two survivor spaces, and tenured generations are using; and when compile and GC blips occur. You simply run your Java game, get the task manager up to find its process ID, and then from the command prompt type visualgc and Bob’s your uncle.
By watching the graphs whilst playing Alien Flux I’ve discovered to my delight that the only memory allocations going on during the game were in eden space, slowly, and that during the normal course of the game none of the objects survived to the survivor or tenured generation. So I set my eden space to be super small (500K) and hence collected much, much more frequently. I also picked an appropriate collector from the 4 now available to use on my dualie 1GHz dev box and ended up with this neat-o set of parameters for running AF:
-server -XX:CompileThreshold=200 -XX:MaxInlineSize=16 -Xmx32m -Xms32m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=500K -XX:MaxNewSize=500K -XX:+DisableExplicitGC -Djava.library.path=.
I’d be especially interested if anyone could test this config. on a slower box (300-600MHz) to tell me if it’s unnacceptably slow starting up (>20secs).
Cas