开发者

Making object eligible to be cleaned up

I have very simple question but the answer is still not clear. If i have class Person and inside开发者_开发问答 class Person there is one attribute which references to other object(ex: Account). If Person object is eligible for GC so either that attribute will be eligible to be cleaned up?


If Person object is eligible for GC so either that attribute will be eligible to be cleaned up?

Yes, unless some other object has a reference to that very account object.

Basically any object that can't be referred to in the future is eligible for GC.


Yes, as soon as the instance of Person is removed by the GC, the instance of Account will also get eligible if no other reference to it exists.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜