参数:-Xmx20m -Xms20m -XX:NewRatio=1 -XX:SurvivorRatio=2 -XX:+PrintGCDetails -XX:PermSize=2m
结果:
Heap
PSYoungGen total 7680K, used 3697K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
eden space 5120K, 41% used [0x00000000ff600000,0x00000000ff8167c8,0x00000000ffb00000)
from space 2560K, 60% used [0x00000000ffd80000,0x00000000fff06020,0x0000000100000000)
to space 2560K, 0% used [0x00000000ffb00000,0x00000000ffb00000,0x00000000ffd80000)
ParOldGen total 10240K, used 0K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
object space 10240K, 0% used [0x00000000fec00000,0x00000000fec00000,0x00000000ff600000)
PSPermGen total 2560K, used 2546K [0x00000000f9a00000, 0x00000000f9c80000, 0x00000000fec00000)
object space 2560K, 99% used [0x00000000f9a00000,0x00000000f9c7c818,0x00000000f9c80000)
猜论:
1、PSYoungGen total 为7680k,等于一个eden space(5210k)和from space(2560k)之和,to space(2560k)是不计入YoungGen中的
换句话说,年轻代的实际总大小需要减去一个幸存代
2、NewRadio=1 ,年轻代和年老代1:1平分20M,各占10240k
3、PermSize不说了,这个差点就溢出了
4、SurvivorRadio=2 这个就是 eden:from:to=2:1:1,然后结果就是:5120k:2560K:2560K