`
echohfut
  • 浏览: 224475 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Eclipse GC log

 
阅读更多

为了查看Eclipse GC log,需要在eclipse.ini 中加入

 

 

-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-verbose:gc
-Xloggc:gc.log

 

 

在Eclipse安装目录查看gc.log

 

9.768: [Full GC 9.769: [Tenured: 7678K->9025K(27328K), 0.3117731 secs] 9172K->9025K(39616K), [Perm : 16383K->16383K(16384K)], 0.3122537 secs]

 

从上面的日志看似有perm 区(16384K)满引起的Full GC, 需要增大perm区空间和初始空间

 

 

-XX:PermSize=64m
-XX:MaxPermSize=64m

 

 在重启Eclipse有如下log

 

 

1.338: [GC 1.338: [DefNew: 10944K->1028K(12288K), 0.0223470 secs] 10944K->1028K(39616K), 0.0224436 secs] [Times: user=0.03 sys=0.00, real=0.03 secs] 

2.053: [GC 2.053: [DefNew: 11972K->434K(12288K), 0.0159322 secs] 11972K->1431K(39616K), 0.0161071 secs] [Times: user=0.01 sys=0.00, real=0.02 secs] 

2.923: [GC 2.923: [DefNew: 11378K->1048K(12288K), 0.0192125 secs] 12375K->2044K(39616K), 0.0193916 secs]

 

 

貌似初始yong 区空间小了引起yong GC,让初始堆空间跟最大堆空间一样大(yong区应该也会按比例增大吧),GC消除了。

 

最终eclipse.ini如下

 

 

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms384m
-Xmx384m
-XX:PermSize=64m
-XX:MaxPermSize=64m
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-verbose:gc
-Xloggc:gc.log

 

 

 

有趣的是关掉Eclipse会看到如下的log

 

 

20.639: [GC 20.639: [DefNew: 104960K->12258K(118016K), 0.2109056 secs] 104960K->12258K(380160K), 0.2110277 secs] [Times: user=0.20 sys=0.00, real=0.20 secs] 

31.909: [GC 31.909: [DefNew: 117218K->7351K(118016K), 0.2577353 secs] 117218K->19392K(380160K), 0.2578431 secs] [Times: user=0.24 sys=0.00, real=0.25 secs] 

Heap

 def new generation   total 118016K, used 37344K [0x02b00000, 0x0ab00000, 0x0ab00000)

  eden space 104960K,  28% used [0x02b00000, 0x0484a4c0, 0x09180000)

  from space 13056K,  56% used [0x09180000, 0x098add90, 0x09e40000)

  to   space 13056K,   0% used [0x09e40000, 0x09e40000, 0x0ab00000)

 tenured generation   total 262144K, used 12041K [0x0ab00000, 0x1ab00000, 0x1ab00000)

   the space 262144K,   4% used [0x0ab00000, 0x0b6c25c0, 0x0b6c2600, 0x1ab00000)

 compacting perm gen  total 65536K, used 36982K [0x1ab00000, 0x1eb00000, 0x1eb00000)

   the space 65536K,  56% used [0x1ab00000, 0x1cf1d8e0, 0x1cf1da00, 0x1eb00000)

No shared spaces configured.



1:是什么触发了yong GC?关Eclipse时需要创建对象引起GC释放更多的对象?
2: Yong 区空间118016K + tenured 空间262144K = 380160K, 这约等于我们Xms/Xmx设置的空间。所以xms/xmx大小不包括perm区空间

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics