在jdk 1.6.0 update 14中终于包含了Garbage first,在release notes 里有这么一段:
Although G1 is available for use in this release, note that production use of G1 is only permitted where a Java support contract has been purchased.
也就是说,未经允许,不能在生产环境使用了。
To try G1, specify these command line options:
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
In addition, the following options can be used to affect G1's behaviour:
To set the max GC pause time goal in milliseconds that G1 will attempt to meet: -XX:MaxGCPauseMillis=<X>
To set the time interval over which GC pauses totaling up to MaxGCPauseMillis may take place: -XX:GCPauseIntervalMillis=<X>