Use JVM GC args -XX: SurvivorRatio = 8 not working

I use java -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 GCTest to set the ratio of survivors, but it just doesn't work! GCDetail prints the following data:

[GC [PSYoungGen: 7495K->144K(9216K)] 7495K->144K(19456K), 0.0010500 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 7561K->120K(9216K)] 7561K->120K(19456K), 0.0007090 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 7344K->128K(9216K)] 7344K->128K(19456K), 0.0009420 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
[GC [PSYoungGen: 7333K->128K(9216K)] 7333K->128K(19456K), 0.0004850 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 7320K->128K(9216K)] 7320K->128K(19456K), 0.0010080 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 7312K->128K(10048K)] 7312K->128K(20288K), 0.0009700 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
[GC [PSYoungGen: 9356K->0K(10048K)] 9356K->116K(20288K), 0.0009580 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 9224K->0K(10048K)] 9340K->116K(20288K), 0.0003100 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 9221K->0K(10048K)] 9337K->116K(20288K), 0.0002790 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 9219K->0K(9920K)] 9335K->116K(20160K), 0.0004440 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 9218K->0K(9984K)] 9334K->116K(20224K), 0.0003780 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC [PSYoungGen: 9218K->0K(9984K)] 9334K->116K(20224K), 0.0003980 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
Heap
 PSYoungGen      total 9984K, used 5316K [0xb2e00000, 0xb3800000, 0xb3800000)
  eden space 9728K, 54% used [0xb2e00000,0xb3331300,0xb3780000)
  from space 256K, 0% used [0xb37c0000,0xb37c0000,0xb3800000)
  to   space 256K, 0% used [0xb3780000,0xb3780000,0xb37c0000)
 PSOldGen        total 10240K, used 116K [0xb2400000, 0xb2e00000, 0xb2e00000)
  object space 10240K, 1% used [0xb2400000,0xb241d060,0xb2e00000)
 PSPermGen       total 16384K, used 1759K [0xae400000, 0xaf400000, 0xb2400000)
  object space 16384K, 10% used [0xae400000,0xae5b7f70,0xaf400000)

"from" and "to" has only 256K, I have to be 1024K, and eden has 8192K. Did I give the wrong arguments?

Java version:

java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)

OS: Ubuntu 11.10

+5
source share
1 answer

-XX:SurvivorRatioignored if you are not using -XX-UseAdaptiveSizePolicy.

UseAdaptiveSizePolicy must be disabled so that you can independently determine the size of the survivors.

See also Java Parameters Hotspot VM or Java Performance which explains all the arguments.

+3
source

All Articles