Their size can be specified with the usual parameters (e.g., -XX:SurvivorRatio=6).įinally, to run G1 at its full potential, try setting these two parameters which are currently disabled by default because they may uncover a rare race condition: G1 also uses the equivalent of survivor spaces, which are, naturally, a set of (potentially non-contiguous) regions. XX:+G1YoungGenSize=512m (for a 512 megabyte young generation) They might work well in some situations but not in others, and the GC might not always be able to obey them.Īlternatively, the size of the young generation can be specified explicitly to impact evacuation pause times: Note that the above two options represent goals, not promises or guarantees. XX:GCPauseIntervalMillis =200 (for a pause interval target of 200ms) With G1, a time interval can be specified during which a GC pause should last no longer than the time given above: XX:MaxGCPauseMillis =50 (for a pause time target of 50ms) To set a GC pause time goal, use the following parameter: XX:+UnlockExperimentalVMOptions -XX:+UseG1GC Using G1 G1 is still considered experimental and can be enabled with the following two parameters:
Here you can find plenty of information on how to use and configre the new garbage collector:
Yes, G1 is the new standard garbage collector in Java 1.7 JVM.
I don’t know where you can find any good documentation. XX:InitialHeapSize=132304640 -XX:MaxHeapSize=2116874240 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation You don’t need to enable experimental options to turn on the G1 collector any more, though: > java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseG1GC -version Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode) Java(TM) SE Runtime Environment (build 1.7.0_01-b08) XX:InitialHeapSize=132304640 -XX:MaxHeapSize=2116874240 -XX:ParallelGCThreads=4 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC You can see for yourself by using with some extra command line options: > java -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -version The G1 garbage collector is not the default in my installation of Java, version 1.7.0_01.