6

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?

  • Could you please post the result of `java -version`? – The Alchemist Aug 24 '10 at 15:40
  • Sure. It does work with: java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode) But it does NOT work with either of these: java version "1.7.0-ea" Java(TM) SE Runtime Environment (build 1.7.0-ea-b106) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b05, mixed mode) and java version "1.6.0_21" Java(TM) SE Runtime Environment (build 1.6.0_21-b06) Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode) – Cameron Balahan Aug 25 '10 at 20:11
  • Without looking at the source code, my guess is that `G1YoungGenSize` was removed, perhaps temporarily. `-XX` options do that. – The Alchemist Aug 26 '10 at 13:26

1 Answers1

6

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
  • 1,879
  • 1
  • 18
  • 32