在學習gc時使用這段代碼分析gc日志,實際進行了兩次的gc,理解應該是一次gc,將3個2mb的小對象移動到老年代,4mb新對象直接放在eden區(qū)域,希望大家?guī)椭依斫庀?br>/**
* jvm args: -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:UseSerialGC
* 說明:JDK為1.7
*/
public static void minorGC() {
byte[] alloction1, alloction2, alloction3, alloction4;
alloction1 = new byte[2 * _1MB];
alloction2 = new byte[2 * _1MB];
alloction3 = new byte[2 * _1MB];
alloction4 = new byte[4 * _1MB];
}
***********GC日志*********
[GC[DefNew: 7021K->1024K(9216K), 0.0056361 secs] 7021K->3223K(19456K), 0.0056954 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
[GC[DefNew: 5339K->0K(9216K), 0.0052367 secs] 7538K->7114K(19456K), 0.0052673 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap
def new generation total 9216K, used 4186K [0x00000000f9a00000, 0x00000000fa400000, 0x00000000fa400000)
eden space 8192K, 51% used [0x00000000f9a00000, 0x00000000f9e16778, 0x00000000fa200000)
from space 1024K, 0% used [0x00000000fa200000, 0x00000000fa200088, 0x00000000fa300000)
to space 1024K, 0% used [0x00000000fa300000, 0x00000000fa300000, 0x00000000fa400000)
tenured generation total 10240K, used 7113K [0x00000000fa400000, 0x00000000fae00000, 0x00000000fae00000)
the space 10240K, 69% used [0x00000000fa400000, 0x00000000faaf27c8, 0x00000000faaf2800, 0x00000000fae00000)
compacting perm gen total 21248K, used 4840K [0x00000000fae00000, 0x00000000fc2c0000, 0x0000000100000000)
the space 21248K, 22% used [0x00000000fae00000, 0x00000000fb2ba140, 0x00000000fb2ba200, 0x00000000fc2c0000)
No shared spaces configured.
發(fā)生YGC時的一些細節(jié)簡書 占小狼[http://www.itdecent.cn/users/90ab66c248e6/latest_articles]轉(zhuǎn)載請注明原創(chuàng)出處,謝謝! 周末抽空把YG...