heapdump上对象的保留大小是多少? [英] What is retained size for an object on heapdump?
问题描述
我最近在Netbeans(6.7)中增加了对Profiler的使用,这是一个很棒的工具。
I've recently increase my use of the Profiler in Netbeans (6.7), this is a great tool.
但我有一个问题。在进行堆转储时,在摘要页面(期望窗口)上可以按保留大小找到最大的对象。
I have a question however. When taking a heap dump, on the summary page (expect window) it is possible to 'find the biggest objects by retained size'.
这个值是什么,以及如何它用于分析内存使用情况?
What is this value and how is it used to analyze memory usage?
推荐答案
对象的保留大小是此对象从垃圾回收中保留的内存量。
The retained size for an object is the quantity of memory this objects preserves from garbage collection.
正式定义是对象的大小加上仅由第一个对象引用的所有对象的大小,递归。
The formal definition is "the size of the object plus the size of all objects referenced only by the first object, recursively".
有关保留内存的更多说明,请参阅本文。
For more explanations about what the retained memory is, see this article.
记住它的一个简单方法是,如果取消引用该对象,保留的内存就是垃圾收集的所有内存。
One easy way to remember it is that the retained memory is all the memory that could be garbage collected if this object was dereferenced.
这篇关于heapdump上对象的保留大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!