我看到很多类卸载,我的整个系统在那段时间会挂起..
[Unloading class sun.reflect.GeneratedMethodAccessor117]
[Unloading class sun.reflect.GeneratedConstructorAccessor1896]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor485]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor579]
.... // about 1700 of them
同时我没有看到 perm 空间的峰值,所以它似乎不是 GC 事件。
我想知道以下内容
Concurrent Mark Sweep 收集是一个停止世界的事件吗?
即使 perm 空间未满也会发生吗?
最佳答案
CMS是GC的一种,分为阶段
如您所见,有两个阶段 - Initial mark 和 Remark 是停止世界事件。
Source : 在 Reviewing Generational GC and CMS
部分下。
Does it happen even when the perm space is not full?
AFAIK 为此你应该有 CMSClassUnloadingEnabled
和 UseConcMarkSweepGC
。当 permgen 区域达到它的阈值时,FGC 将被触发。
此外,如果 permgen 区域被填满(并且 GC 仍在处理 permgen 区域),尽管 Concurrent Sweep(短语(4))不是 STW 事件,但它可能导致停止所有进程线程并且只有 GC 线程运行直到所有需要的内存被占用回收。
关于java - Concurrent Mark Sweep (CMS) 是停止世界事件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21230165/