在学习gc时使用这段代码分析gc日志,实际进行了两次的gc,理解应该是一次gc,将3个2mb的小对象移动到老年代,4mb新对象直接放在eden区域,希望大家帮助我理解下
/**
* 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.
发生YGC时的一些细节简书 占小狼[https://www.jianshu.com/users/90ab66c248e6/latest_articles]转载请注明原创出处,谢谢! 周末抽空把YG...