-XX:+PrintGCDetails
一、代码
public class GcDemo {
public static void main(String[] args) {
Object obj = new Object();
obj = null;
System.gc();
}
}
二、配置
三、测试
[GC (System.gc()) [PSYoungGen: 5242K->872K(152576K)] 5242K->880K(500736K), 0.0011529 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[Full GC (System.gc()) [PSYoungGen: 872K->0K(152576K)] [ParOldGen: 8K->625K(348160K)] 880K->625K(500736K), [Metaspace: 3130K->3130K(1056768K)], 0.0042044 secs] [Times: user=0.00 sys=0.02, real=0.01 secs]
Heap
PSYoungGen total 152576K, used 3932K [0x0000000716000000, 0x0000000720a00000, 0x00000007c0000000)
eden space 131072K, 3% used [0x0000000716000000,0x00000007163d7290,0x000000071e000000)
from space 21504K, 0% used [0x000000071e000000,0x000000071e000000,0x000000071f500000)
to space 21504K, 0% used [0x000000071f500000,0x000000071f500000,0x0000000720a00000)
ParOldGen total 348160K, used 625K [0x00000005c2000000, 0x00000005d7400000, 0x0000000716000000)
object space 348160K, 0% used [0x00000005c2000000,0x00000005c209c5e0,0x00000005d7400000)
Metaspace used 3144K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 341K, capacity 388K, committed 512K, reserved 1048576K