Java之CMS GC Causes

栏目: Java · 发布时间: 5年前

阅读更多

Allocation Failure

Allocation Failure happens when there isn't enough free space to create new objects in Young generation . Allocation failures triggers Young GC .

On Linux, the JVM can trigger a GC if the kernel notifies there isn't much memory left via mem_notify.

  • 产生原因:新生代没有足够的空间分配对象。
  • 触发GC类型:Young GC。

GCLocker Initiated GC

The GC locker prevents GC from occurring when JNI code is in a critical region. If GC is needed while a thread is in a critical region , then it will allow them to complete, i.e. call the corresponding release function. Other threads will not be permitted to enter a critical region. Once all threads are out of critical regions a GC event will be triggered .

  • 产生原因:如果线程执行在JNI临界区时,刚好需要进行GC,此时GC locker将会阻止GC的发生,同时阻止其他线程进入JNI临界区,直到最后一个线程退出临界区时触发一次GC。
  • 触发GC类型:GCLocker Initiated GC。

Promotion Failure

Promotion Failure happens when there is no continuous memory space to promote larger object , even though total free memory is large enough . This is problem is called as heap fragmentation. Promotion Failure typically triggers Full GC .

  • 产生原因:老年代没有足够的连续空间分配给晋升的对象(即使总可用内存足够大)。
  • 触发GC类型:Full GC。
  • 解决方法:增加堆内存,特别是新生代内存,尽可能让对象在新生代被回收掉。减少对象的创建,缩短对象的生命周期。

Concurrent Mode Failure

The CMS collector uses one or more garbage collector threads that run simultaneously with the application threads with the goal of completing the collection of the tenured generation before it becomes full. In normal operation, the CMS collector does most of its tracing and sweeping work with the application threads still running, so only brief pauses are seen by the application threads. However, if the CMS collector is unable to finish reclaiming the unreachable objects before the tenured generation fills up, or if an allocation cannot be satisfied with the available free space blocks in the tenured generation, then the application is paused and the collection is completed with all the application threads stopped . The inability to complete a collection concurrently is referred to as concurrent mode failure and indicates the need to adjust the CMS collector parameters. Concurrent mode failure typically triggers Full GC .

  • 产生原因:CMS GC运行期间,老年代预留的空间不足以分配给新的对象。
  • 触发GC类型:Full GC。
  • 解决方法:适当调低-XX:CMSInitiatingOccupancyFraction,或者增加老年代内存。

关于GCLocker Initiated GC

shipilev.net/jvm-anatomy…

bugs.openjdk.java.net/browse/JDK-…

www.zhihu.com/question/61…

docs.oracle.com/javase/8/do…

docs.oracle.com/javase/8/do…

转载请注明来源:http://zhanjia.iteye.com/blog/2434083

个人公众号

更多文章,请关注公众号:二进制之路

Java之CMS GC Causes

保持好奇心,把时间花在刀刃上

评论


以上所述就是小编给大家介绍的《Java之CMS GC Causes》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C++标准程序库

C++标准程序库

[德] Nicolai M. Josuttis / 侯捷、孟岩 / 华中科技大学出版社 / 2002-9 / 108.00元

这本包含最新资料的完整书籍,反映出被ANSI/ISO C++语言标准规格书纳入的C++标准程序库的最新组成。更明确地说,这本书将焦点放在标准模板库身上,检验其中的容器、迭代器、仿函数和算法。读者还可以找到特殊容、字串、数值类别、国际化议题、IOStream。每一个元素都有深刻的呈现,包括其介绍、设计、运用实例、细部解说、陷阱、意想不到的危险,以及相关类别和函数的精确樯记式和定义式。一起来看看 《C++标准程序库》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

MD5 加密
MD5 加密

MD5 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具