“孤岛"垃圾收集 [英] "Island of isolation" of Garbage Collection

查看:26
本文介绍了“孤岛"垃圾收集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释一下垃圾收集的孤立岛的概念吗?

Could anyone please explain the concept of Island of isolation of Garbage Collection?

推荐答案

对象 A 引用对象 B.对象 B 引用对象 A.对象 A 和对象 B 都没有被任何其他对象引用.那是一座孤岛.

Object A references object B. Object B references object A. Neither object A nor object B is referenced by any other object. That's an island of isolation.

基本上,隔离岛是一组相互引用但不被应用程序中任何活动对象引用的对象.严格来说,即使是单个未引用的对象也是一个孤立的孤岛.

Basically, an island of isolation is a group of objects that reference each other but they are not referenced by any active object in the application. Strictly speaking, even a single unreferenced object is an island of isolation too.

从评论

class A {
   B myB; 
} 
class B { 
   A myA; 
} 

/* later */  
A a = new A(); 
B b = new B();  
a.b = b; 
b.a = a;

这篇关于“孤岛"垃圾收集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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