GC 测试
App
public class GCApp {
// 1 MB = 1024 KB, 1 KB = 1024 B(字节), 1 B=8 b(bit比特)
public static final int MB = 1024 * 1024;
public static void main(String[] args) {
byte[] a1, a2, a3, a4;
a1 = new byte[2 * MB];
a2 = new byte[2 * MB];
a3 = new byte[2 * MB];
a4 = new byte[4 * MB];
}
}
vm option
-verbose:gc
-Xms20m
-Xmx20m
-Xmn10M
-XX:+PrintGCDetails
-XX:SurvivorRatio=8
Heap
PSYoungGen total 9216K, used 8155K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
eden space 8192K, 99% used [0x00000007bf600000,0x00000007bfdf6fe8,0x00000007bfe00000)
from space 1024K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007c0000000)
to space 1024K, 0% used [0x00000007bfe00000,0x00000007bfe00000,0x00000007bff00000)
ParOldGen total 10240K, used 4096K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
object space 10240K, 40% used [0x00000007bec00000,0x00000007bf000010,0x00000007bf600000)
Metaspace used 3192K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 355K, capacity 388K, committed 512K, reserved 1048576K