垃圾收集问题在年轻一代 [英] garbage collection issue in young generation
问题描述
如果无法完成/完成次要集合,主要/完整收集被执行。这通常是使用mark-sweep-compact算法而不是复制算法来完成的......这是完整收集成本昂贵的一个原因。但最终(如果你保留填满堆)一个完整的集合将无法回收足够的空间来继续和OOME将被抛出。 (或者,如果您使用的是 -XX:+ UseGCOverheadLimit
,那么当在GC中花费的时间百分比超过指定的阈值时,将引发OOME。)
When Eden space is young generation is full, minor GC will be triggered. And in the minor GC process, non-free objects in Eden and one source Survivor space will be copied to another destination Survivor space.
My question is, if the destination Survivor space is full, how could minor GC handle?
If it is not possible to do / complete a minor collection, then a major / full collection is performed. This is typically done using a mark-sweep-compact algorithm rather than copying algorithm ... which is one reason why full collection is expensive.
But ultimately (if you keep filling the heap) a full collection will not be able to reclaim enough space to continue and an OOME will be thrown. (Or if you are using -XX:+UseGCOverheadLimit
, the OOME will be thrown when the percentage time spent in GC exceeds a designated threshold.)
这篇关于垃圾收集问题在年轻一代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!