views:

128

answers:

1

I am using the G1 garbage collector with JDK1.7.0, but the VM does not recognize the option G1YoungGenSize. Specifically, when I run:

java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1YoungGenSize=512m ...

I get the following error:

Unrecognized VM option 'G1YoungGenSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I have also tried it with a "+" sign before G1YoungGenSize, as some of the G1 documentation lists it that way:

java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:+G1YoungGenSize=512m ...

But I get the same error.

I have tried older JDKs, including 1.6 update 18 through 21. It seems that G1YoungGenSize is recognized through update 20, and breaks beginning with 21 and through the latest 1.7 build (snapshot dated August 19, 2010).

Does anyone know what could be causing this error?

+2  A: 

This looks to have changed about 6 months ago:

6928065: G1: use existing command line parameters to set the young generation size http://hg.openjdk.java.net/jdk7/jdk7/hotspot/rev/a1c410de27e4

Changes made for 1.6 here:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6928065

To be consistent with the other GCs, G1 should observe UseAdaptiveSizePolicy to decide whether to auto-tune the young generation size. NewSize / MaxNewSize (and also -Xmn) should dictate the initial max size.

Danny Thomas