为什么旧的对象由次要GC清除 [英] Why Old generation objects clearing up by minor GC

查看:51
本文介绍了为什么旧的对象由次要GC清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java 11和G1GC.我正在处理的应用程序是一个大数据应用程序,我注意到的奇怪的事情是我正在监视该应用程序24小时,并且没有主要的GC.但是Old gen的大小周期性地一次又一次地减小,巧合的是,当次要GC在同一分钟花费大量时间时,这种情况正在发生.
我无法理解为什么次要GC上的尖峰会清除Old gen中的数据.

I am using Java 11 and using G1GC. The application that I am working on is a big data application, and the weird thing that I am noticing is that I am monitoring the application for 24 hours, and there is no major GC. But the size of Old gen is going down again and again periodically, and coincidently it is happening when minor GC is taking a lot of time at the same minute.
I am not able to understand why spikes on minor GC are clearing out data from Old gen.

推荐答案

G1 GC还具有混合GC的概念,该概念为G1 GC命名为垃圾优先".在此GC中,清理了年轻一代以及旧空间中包含最多垃圾的多个区域,即垃圾优先".这种机制允许G1 GC尝试尽可能长的时间避免使用Full GC.由于完整的GC主要负责与垃圾回收相关的较长的暂停时间,因此G1 GC可以最大程度地减少对这些昂贵操作的需求.

The G1 GC also has the concept of a Mixed GC which gives G1 GC its name - Garbage First. In this GC, the young generation is cleaned as well as a number of regions from the Old space that contain the most garbage, that is, Garbage First. This mechanism allows the G1 GC to attempt to avoid the Full GCs for as long as possible. As the full GCs are mainly responsible for the long pause time associated with garbage collections, the G1 GC is able to minimize the need for these expensive operations.

这篇关于为什么旧的对象由次要GC清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆