“隔离岛”垃圾收集 [英] "Island of isolation" of Garbage Collection

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

问题描述

任何人都可以解释隔离岛的垃圾收集概念吗?

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

推荐答案

对象引用对象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天全站免登陆