-XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:d:/gc_log/gc.log
package com.tets;
public class ReferenceCountingGC {
public Object instance = null;
private static final int _1MB = 1024*1024;
private byte[] bigSize = new byte[2 * _1MB];
public static void testGC(){
ReferenceCountingGC obja =new ReferenceCountingGC();
ReferenceCountingGC objb = new ReferenceCountingGC();
obja.instance =objb;
objb.instance =obja;
obja = null;
objb = null;
System.gc();
System.out.println("--------------");
}
public static void main(String[] args) {
testGC();
}
}
2017-08-30T22:03:53.744+0800: 1.202: [GC 1.210: [DefNew: 2505K->170K(4928K), 0.0270798 secs] 2505K->2219K(15872K), 0.0353489 secs] [Times: user=0.00 sys=0.00, real=0.04 secs]
2017-08-30T22:03:53.779+0800: 1.238: [Full GC (System) 1.238: [Tenured: 2048K->170K(10944K), 0.0548002 secs] 4267K->170K(15872K), [Perm : 2335K->2335K(12288K)], 0.0554659 secs] [Times: user=0.01 sys=0.00, real=0.06 secs]
Heap
def new generation total 4992K, used 96K [0x04510000, 0x04a70000, 0x09a60000)
eden space 4480K, 2% used [0x04510000, 0x04528028, 0x04970000)
from space 512K, 0% used [0x04970000, 0x04970000, 0x049f0000)
to space 512K, 0% used [0x049f0000, 0x049f0000, 0x04a70000)
tenured generation total 10944K, used 170K [0x09a60000, 0x0a510000, 0x14510000)
the space 10944K, 1% used [0x09a60000, 0x09a8abd0, 0x09a8ac00, 0x0a510000)
compacting perm gen total 12288K, used 2347K [0x14510000, 0x15110000, 0x18510000)
the space 12288K, 19% used [0x14510000, 0x1475af30, 0x1475b000, 0x15110000)
No shared spaces configured.