United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6862534 -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepGC
JDK-6862534 : -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepGC

Details
Type:
Bug
Submit Date:
2009-07-21
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
linux,windows_xp
Sub-Component:
gc
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.2,5.0,6u14
Fixed Versions:
hs16 (b08)

Related Reports
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)

FULL OS VERSION :
Linux strongbad 2.6.28-13-generic #44-Ubuntu SMP Tue Jun 2 07:55:09 UTC 2009 x86_64 GNU/Linux

Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
-XX:NewRatio does not work at all in combination with -XX:+UseConcMarkSweepGC

The docs don't list any limitations on the use of NewRatio - in fact, they suggest that it be used in certain cases.

http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html

With default GC, and NewRatio set to 3, and MaxHeap set to 600 MB, I would expect my new generation space to be somewhere around 200 MB.

Working Example:

 =>/opt/java/jre_x32_1.6.0_14/bin/java -server -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:NewRatio=3 -Xms600M -Xmx600M -version

-XX:MaxHeapSize=629145600 -XX:NewRatio=3 -XX:ParallelGCThreads=2 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseParallelGC
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
Heap
 PSYoungGen      total 134400K, used 2304K [0xeaa40000, 0xf4040000, 0xf4040000)
  eden space 115200K, 2% used [0xeaa40000,0xeac80010,0xf1ac0000)
  from space 19200K, 0% used [0xf2d80000,0xf2d80000,0xf4040000)
  to   space 19200K, 0% used [0xf1ac0000,0xf1ac0000,0xf2d80000)
 PSOldGen        total 460800K, used 0K [0xce840000, 0xeaa40000, 0xeaa40000)
  object space 460800K, 0% used [0xce840000,0xce840000,0xeaa40000)
 PSPermGen       total 16384K, used 1431K [0xca840000, 0xcb840000, 0xce840000)
  object space 16384K, 8% used [0xca840000,0xca9a5c88,0xcb840000)

I end up with 134400K - perfectly reasonable.  The ratio is 134400 / 460800 = .29 - just shy of the 1:3 ratio I was asking for.

Failing example - same command as above, except now, adding CMS:

 =>/opt/java/jre_x32_1.6.0_14/bin/java -server -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:NewRatio=3 -Xms600M -Xmx600M -XX:+UseConcMarkSweepGC -version

-XX:MaxHeapSize=629145600 -XX:MaxNewSize=33554432 -XX:MaxTenuringThreshold=4 -XX:NewRatio=3 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
Heap
 par new generation   total 29504K, used 524K [0xca770000, 0xcc770000, 0xcc770000)
  eden space 26240K,   2% used [0xca770000, 0xca7f3340, 0xcc110000)
  from space 3264K,   0% used [0xcc110000, 0xcc110000, 0xcc440000)
  to   space 3264K,   0% used [0xcc440000, 0xcc440000, 0xcc770000)
 concurrent mark-sweep generation total 581632K, used 0K [0xcc770000, 0xeff70000, 0xeff70000)
 concurrent-mark-sweep perm gen total 16384K, used 1431K [0xeff70000, 0xf0f70000, 0xf3f70000)

And I get 29504K.  29504 / 581632 = .05 = or a ratio of 1:20.

You will also notice from the output of PrintCommandLineFlags that the VM has decided to set  -XX:MaxNewSize=33554432, even though I did not specify it on the command line.


Same broken behaviour on Linux and Windows.




THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Use the NewRatio flag as documented.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
-XX:NewSize=xx works as expected.

                                    

Comments
EVALUATION

If NewRatio is set on the command line, skip the ergonomic setting of the
young gen maximum size and let the CollectorPolicy set the generation sizes.
                                     
2009-07-27
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/061cd4d965fc
                                     
2009-08-03
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/061cd4d965fc
                                     
2009-08-06



Hardware and Software, Engineered to Work Together