java heapdump 上对象的保留大小是多少?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3635787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is retained size for an object on heapdump?
提问by Thirler
I've recently increase my use of the Profiler in Netbeans (6.7), this is a great tool.
我最近在 Netbeans (6.7) 中增加了对 Profiler 的使用,这是一个很棒的工具。
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?
这个值是什么以及它如何用于分析内存使用情况?
回答by Vivien Barousse
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.
记住它的一种简单方法是保留的内存是如果取消引用此对象可以被垃圾收集的所有内存。