UseConcMarkSweepGC详细的gc输出显示内存丢失

时间:2012-11-29 23:02:33

标签: java garbage-collection

我有一个已启用GC日志记录的应用程序。堆似乎增长然后突然下降,但不记录完整GC。如果有一些我可以启用的启动参数将显示哪些GC事件正在减少堆大小?

我的环境: Linux 64位,java 1.6.0_31,Java HotSpot(TM)64位服务器VM(内置20.6-b01,混合模式)

VM args: -server -Xms2560m -Xmx2560m -XX:+ UseConcMarkSweepGC -XX:MaxPermSize = 256m -XX:-PrintGC -XX: -PrintGCDetails -XX:-PrintGCTimeStamps -Xloggc:/xxxxx / gc.log -Dsun.rmi.dgc.client.gcInterval = 86400000 -Dsun.rmi.dgc.server.gcInterval = 86400000

3057.609: [GC 2397254K->2385777K(2619328K), 0.0572310 secs]
3058.898: [GC 2402801K->2391301K(2619328K), 0.0566620 secs]
3059.940: [GC 2408325K->2397156K(2619328K), 0.0534080 secs]
3059.995: [GC 2397265K(2619328K), 0.0069950 secs]
3065.635: [GC 2414180K->2404934K(2619328K), 0.0732700 secs]
3065.849: [GC 2419994K(2619328K), 0.1150630 secs]
3070.248: [GC 1593931K->1591825K(2619328K), 0.1084230 secs]
3072.440: [GC 1608552K->1606431K(2619328K), 0.0533140 secs]
3087.759: [GC 1623455K->1614544K(2619328K), 0.0215850 secs]

什么事件导致堆在3065.849和3070.248的输出之间缩小?是否有一个VM param会记录它?我尝试添加-verbose:gc,但这不会改变输出。

2 个答案:

答案 0 :(得分:0)

GC分两步进行

1)次要收集(主要是清洁年轻一代)

2)主要收藏

我猜你所看到的是小集合。这个tutorial可以帮助您理解这些术语。

答案 1 :(得分:0)

马克的评论有正确的答案,我没有正确启用详情。现在我看到了这个事件:

5505.399: [GC 5505.399: [DefNew: 17273K->1942K(19136K), 0.0172730 secs] 2408937K->2393606K(2619328K), 0.0175180 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
5524.922: [GC 5524.922: [DefNew: 18948K->2111K(19136K), 0.0268990 secs] 2410612K->2395349K(2619328K), 0.0271850 secs] [Times: user=0.02 sys=0.01, real=0.03 secs]
5524.950: [GC [1 CMS-initial-mark: 2393237K(2600192K)] 2395413K(2619328K), 0.0088880 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
5524.959: [CMS-concurrent-mark-start]
5527.608: [CMS-concurrent-mark: 2.645/2.650 secs] [Times: user=2.62 sys=0.00, real=2.65 secs]
5527.609: [CMS-concurrent-preclean-start]
5527.624: [CMS-concurrent-preclean: 0.015/0.015 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
5527.625: [GC[YG occupancy: 3557 K (19136 K)]5527.625: [Rescan (non-parallel) 5527.625: [grey object rescan, 0.0065690 secs]5527.632: [root rescan, 0.0088130 secs], 0.0154260 secs]5527.641: [weak refs processing, 0.1026480 secs] [1 CMS-remark: 2393237K(2600192K)] 2396795K(2619328K), 0.1252390 secs] [Times: user=0.13 sys=0.00, real=0.13 secs]
5527.954: [CMS-concurrent-sweep-start]
5531.258: [CMS-concurrent-sweep: 3.304/3.304 secs] [Times: user=3.15 sys=0.02, real=3.30 secs]
5531.258: [CMS-concurrent-reset-start]
5531.264: [CMS-concurrent-reset: 0.006/0.006 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]  
5551.660: [GC 5551.660: [DefNew: 19135K->1234K(19136K), 0.0691830 secs] 1373830K->1357833K(2619328K), 0.0694780 secs] [Times: user=0.07 sys=0.00, real=0.07 secs]
5584.991: [GC 5584.991: [DefNew: 18257K->2111K(19136K), 0.0264920 secs] 1374857K->1360277K(2619328K), 0.0267850 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
5589.794: [GC 5589.794: [DefNew: 19135K->286K(19136K), 0.0189210 secs] 1377301K->1359264K(2619328K), 0.0191450 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
5632.424: [GC 5632.424: [DefNew: 17310K->2111K(19136K), 0.0182480 secs] 1376288K->1361326K(2619328K), 0.0185900 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
5645.086: [GC 5645.087: [DefNew: 19135K->2112K(19136K), 0.0276910 secs] 1378350K->1363056K(2619328K), 0.0279740 secs] [Times: user=0.03 sys=0.00, real=0.03 secs]

感谢。