简体   繁体   English

jVisualVM 的内存检查器中的“保留大小”是什么意思?

[英]What does “retained size” mean in jVisualVM's memory inspector?

Jvisualvm heap dump on summary tab has functionality to inspect bigest objects by retained size.摘要选项卡上的 Jvisualvm 堆转储具有按保留大小检查最大对象的功能。

What does retained really mean?保留的真正含义是什么? How size of an object tree is calculated and shown here?此处如何计算和显示对象树的大小?
In case I can see here object (10M) and it's member object (5M) how should I calculate heap impact.如果我在这里可以看到对象(10M)和它的成员对象(5M),我应该如何计算堆影响。 Does both of them took 10M or 15M of the heap?它们都占用了 10M 还是 15M 的堆?
Why I can't see none of our facade huge application objects?为什么我看不到我们的外观巨大的应用程序对象?

Thanks.谢谢。

What does retained really mean?保留的真正含义是什么?

How big it would be after a full gc.完整的 gc 后会有多大。 Eg a WeakHashMap with a large number of entries could be empty after a GC.例如,在 GC 之后,具有大量条目的 WeakHashMap 可能为空。

How size of an object tree is calculated and shown here?此处如何计算和显示对象树的大小?

The JVM determines this using an internal API. JVM 使用内部 API 确定这一点。

In case I can see here object (10M) and it's member object (5M) how should I calculate heap impact.如果我在这里可以看到对象(10M)和它的成员对象(5M),我应该如何计算堆影响。 Does both of them took 10M or 15M of the heap?它们都占用了 10M 还是 15M 的堆?

The total is 10 MB.总大小为 10 MB。 If this is your biggest problem, wouldn't worry about it unless you have a machine with only a few 100 MB.如果这是您最大的问题,请不要担心,除非您的机器只有 100 MB。 (In which case I would upgrade it) (在这种情况下,我会升级它)

Why I can't see none of our facade huge application objects?为什么我看不到我们的外观巨大的应用程序对象?

Perhaps they are not as big in memory as you think??也许它们的内存没有你想象的那么大?? eg they may be expensive to load, but that doesn't make them huge.例如,加载它们可能很昂贵,但这并不会使它们变大。

BTW: VisualVM is a nice free memory profiler but its only useful for finding obvious problems.顺便说一句:VisualVM 是一个不错的免费内存分析器,但它仅用于发现明显问题。 I would try a commercial profiler like YourKit (which you can get a free eval license for) for comparison.我会尝试使用像 YourKit 这样的商业分析器(您可以获得免费的评估许可证)进行比较。

In case I can see here object (10M) and it's member object (5M) how should I calculate heap impact.如果我在这里可以看到对象(10M)和它的成员对象(5M),我应该如何计算堆影响。 Does both of them took 10M or 15M of the heap?它们都占用了 10M 还是 15M 的堆?

I think it actually took 15M of the heap, object retained size 10M means, 10M will be free when this object(10M) is swept.我认为它实际上占用了 15M 的堆,对象保留大小 10M 意味着,当这个对象(10M)被清扫时,10M 将是空闲的。 The member object(5M) is still referenced by other object, and still in the heap.成员 object(5M) 仍然被其他对象引用,并且仍然在堆中。 Member object's retained size can be larger than object itself.成员对象的保留大小可以大于对象本身。

I think the best definition for "Retained" in the VisualVM is the amount of memory that will remain after garbage collection.我认为 VisualVM 中“保留”的最佳定义是垃圾回收后剩余的内存量。

In some cases it can be bigger than the "Size" since it reference other objects (or collections) directly or indirectly.在某些情况下,它可能大于“大小”,因为它直接或间接引用其他对象(或集合)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM