我使用
java -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 GCTest
来设置幸存者比率,但它却不起作用!
GCDetail打印以下数据:[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"和"to"只有256K,应该是1024K,"eden"有8192K。我传错了参数吗?
Java的版本是:
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)
操作系统:Ubuntu 11.10