简体   繁体   English

Java Full GC - 浮动垃圾?

[英]Java Full GC - Floating Garbage?

Currently I am learning about GC in Java, but I need some clarification.目前我正在学习 Java 中的 GC,但我需要一些说明。 Let's say we have situation like on this picture:假设我们在这张图片上有这样的情况:

在此处输入图片说明

According to this website first runs DefNew and after that Tenured GC.根据这个网站,首先运行 DefNew,然后是 Tenured GC。 In that case:在这种情况下:

  • In DefNew Object A has reference from Old generation, this won't be collected.在 DefNew 对象 A 有来自老年代的引用,这不会被收集。
  • In Tenured (if I get it right), Object B won't be deleted because has a reference from Young Generation (Object A).在 Tenured (如果我做对了)中,对象 B 不会被删除,因为它有来自年轻代(对象 A)的引用。

How does it works after all?它到底是如何工作的? I was thinking about dirty cards, but only Object C would be marked, because it was changed (deleted reference to Object B).我在考虑脏卡,但只有对象 C 会被标记,因为它被更改了(删除了对对象 B 的引用)。

From an article about "nepotism" problem来自一篇关于“裙带关系”问题的文章

This is 'pathological' because ANY promoted node will result in the promotion of ALL following nodes until a GC resolves the issue.这是“病态的”,因为任何提升的节点都将导致所有后续节点的提升,直到 GC 解决问题。

So I guess it will be promoted to Old gen first, then collected.所以我猜它会先晋升为老一代,然后再收集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM