Saturday, January 7, 2012

Enable G1GC

Since Java7 update 2, Java7 becomes stable, steadily. So that now is the time to try G1GC.
> java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC Another args...

If you want to use G1GC commonly, set these VM args to environment variable JAVA_OPTS.
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC"
> java $JAVA_OPTS Another args...
Another advantage to set JAVA_OPTS is that other Java programs often reads and uses this environment variable, e.g. tomcat, JRuby and so forth.

No comments:

Post a Comment