[GC[YG occupancy: 1036 K (9216K)][Rescan (parallel) , 0.0001092 secs][weak refs processing, 0.0000140 secs][1 CMS-remark: 47730K(51200K)] 48766K(60416K), 0.0001609 secs] [Times:user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-sweep: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-reset: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC [ParNew: 9112K->9112K(9216K),0.0000185 secs][CMS: 47728K->51175K(51200K), 0.0184446 secs]56840K->56814K(60416K), [CMS Perm : 2086K->2085K(12288K)], 0.0185255secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
[GC [1 CMS-initial-mark:51175K(51200K)] 56878K(60416K), 0.0000866 secs] [Times: user=0.00 sys=0.00,real=0.00 secs]
[CMS-concurrent-mark: 0.003/0.003secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-preclean:0.002/0.002 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-abortable-preclean:0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC[YG occupancy: 5703 K (9216K)][Rescan (parallel) , 0.0001108 secs][weak refs processing, 0.0000041 secs][1 CMS-remark: 51175K(51200K)] 56878K(60416K), 0.0001523 secs] [Times:user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-sweep: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[CMS-concurrent-reset: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC [ParNew: 9103K->9103K(9216K),0.0000140 secs][CMS: 51172K->51172K(51200K), 0.0135952 secs]60275K->60269K(60416K), [CMS Perm : 2085K->2084K(12288K)], 0.0136662secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
[Full GC [CMS:51172K->51172K(51200K), 0.0041339 secs] 60269K->60269K(60416K), [CMS Perm: 2084K->2084K(12288K)], 0.0041729 secs] [Times: user=0.01 sys=0.00,real=0.01 secs]
[GC[1 CMS-initial-mark: 51172K(51200K)] 60269K(60416K), 0.0000883 secs] [Times:user=0.00 sys=0.00, real=0.00 secs]
…
7、CMS收集器的运作步骤
CMS收集器是基于“标记-清除”算法实现的,它的运作过程相对于前面几种收集器来说要更复杂一些,整个过程分为6个步骤,包括:
初始标记(CMS initial mark)
并发标记(CMS concurrent mark)
并发预清理(CMS-concurrent-preclean)
重新标记(CMS remark)
并发清除(CMS concurrent sweep)
并发重置(CMS-concurrent-reset)
其中初始标记、重新标记这两个步骤仍然需要“Stop The World”。初始标记仅仅只是标记一下GC Roots能直接关联到的对象,速度很快,并发标记阶段就是进行GC Roots Tracing的过程,而重新标记阶段则是为了修正并发标记期间,因用户程序继续运作而导致标记产生变动的那一部分对象的标记记录,这个阶段的停顿时间一般会比初始标记阶段稍长一些,但远比并发标记的时间短。其他动作都是并发的。
对应具体的运行结果:
[GC [ParNew: 9110K->972K(9216K),0.0056278 secs] 48708K->48702K(60416K), 0.0056664 secs] [Times: user=0.00sys=0.00, real=0.01 secs]
【1.初始标记】
[GC [1 CMS-initial-mark:47730K(51200K)] 48766K(60416K), 0.0000829 secs] [Times: user=0.00 sys=0.00,real=0.00 secs]
【2.并发标记】
[CMS-concurrent-mark: 0.003/0.003secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
【3.并发预清理】
[CMS-concurrent-preclean:0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
【4.重新标记】
[GC[YG occupancy: 1036 K (9216K)][Rescan (parallel) , 0.0001092 secs][weak refs processing, 0.0000140 secs][1 CMS-remark: 47730K(51200K)] 48766K(60416K), 0.0001609 secs] [Times:user=0.00 sys=0.00, real=0.00 secs]
【5.并发清除】
[CMS-concurrent-sweep: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
【6.并发重置】
[CMS-concurrent-reset: 0.000/0.000secs] [Times: user=0.00 sys=0.00, real=0.00 secs]