什么是java中的对象图? [英] What is object graph in java?

查看:101
本文介绍了什么是java中的对象图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我研究垃圾收集器时,我都会听到术语对象Graph。这究竟是什么意思?

Whenever I study Garbage Collector I hear the term object Graph. What does it mean exactly?

推荐答案

对象引用其他对象,这些对象又可以引用更多对象,包括起始对象。这将创建一个对象图,在可达性分析中很有用。例如,如果起始对象是可到达的(比如它在线程的本地堆栈中),那么图中的所有对象都是可访问的,并且精确的垃圾收集器无法收集任何这些对象。类似地,如果我们创建一个包含所有可到达对象的列表,则从一组活动对象(根)开始,所有其他对象都是垃圾公平的游戏集合。

Objects have references to other objects which may in turn have references to more objects including the starting object. This creates a graph of objects, useful in reachability analysis. For instance, if the starting object is reachable (say it's in a thread's local stack) then all objects in the graph are reachable and an exact garbage collector cannot harvest any of these objects. Similarly, starting with a set of live objects (roots) if we create a list of all reachable objects, all other objects are garbage - fair game for collection.

这篇关于什么是java中的对象图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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