问题
I can't find any options relating to how G1 operates. The below two commands no longer work with java7.
-XX:+G1ParallelRSetUpdatingEnabled
-XX:+G1ParallelRSetScanningEnabled
回答1:
Only options I am aware of that have an impact on G1 are:
to activate:
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
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>
to set the size of the young generationto impact evacuation pause times:
-XX:+G1YoungGenSize=512m
(also disabled in some versions)to set the (not specific to G1 only) survivor spaces' size
-XX:SurvivorRatio=6
(and other survivor-related options)
Quick Warning
Be warned that all -XX options types are deemed experimental and subject to change at any time (so, usually not stuff you want to stick in the .{bat,sh}
, wrapper.conf
script or config file used to jump-start your enterprise application.
They are pretty useful, but not to rely on too much if you want a stable and durable launcher.
The 2 options you mentioned, while originally available at the time of G1's first public release in the course of Java SE 6 Updates, have now been deprecated. So has G1YoungGenSize
in some versions.
Sources:
- Java SE 6 Update 14 Release Notes
- G1 Garbage First Collector Introduction
- Java HotSpot VM Options
- Plus a presentation on JVM Tuning
回答2:
Java 7 update 4 now "fully supports" the G1 garbage collector, but it seems those parameters are no longer available. :(
These links shed some more light on the allowed JVM flags:
Description of the G1 GC
JVM options
来源:https://stackoverflow.com/questions/8262674/java7-g1-options