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.

<div><br>
<div><br>
<div>1:是什么触发了yong GC?关Eclipse时需要创建对象引起GC释放更多的对象?
<div>2: Yong 区空间118016K + tenured 空间262144K = 380160K, 这约等于我们Xms/Xmx设置的空间。所以xms/xmx大小不包括perm区空间
<div><br>
?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值