thinking-in-java-小记 - 看Thinking in Java碰到的关于Java 垃圾回收机制引发的问题.
巴扎黑
巴扎黑 2017-04-17 17:15:11
[Java讨论组]

最近在看Thinking in Java, 读到How a garbage collector works 这一节的时候有这么几句话不太理解 (前面讲到一种简单但是很慢的垃圾回收的方法是reference counnting)

The garbage collector moves through the entire list of objects, and
when it finds one with a reference count of zero it releases that
storage (however, reference counting schemes often release an object
as soon as the count goes to zero). The one drawback is that if
objects circularly refer to each other they can have nonzero reference
counts while still being garbage.

这是原文, 我不能理解的是为什么出现循环引用的时候他会出现仍然进行垃圾收集,因为循环引用的时候不应该是两个object的counter都到不了0才对嘛,按照正常逻辑这两个object出现的问题应该是永远也不会被垃圾回收,而按照作者的意思恰好相反.

巴扎黑
巴扎黑

全部回复(1)
伊谢尔伦

The one drawback

一个缺点是……

我没有看到意思正好相反啊

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号