[英]Comparing “objects allocated” in a JVisualVM snapshot to number of instances in a Java heap dump
I was using JVisualVM to look at an application, and I saw many objects of SomeDomainClass in the memory profiler and snapshot. 我使用JVisualVM来查看应用程序,并且在内存分析器和快照中看到了SomeDomainClass的许多对象。 A Java heap dump (.hprof file) produced shortly thereafter contained no instances of SomeDomainClass.
此后不久产生的Java堆转储(.hprof文件)不包含SomeDomainClass的实例。 Because the memory profiler "displays the total number of objects allocated", and the hprof file contains the objects active in the heap, does this suggest that the application is creating many short-lived instances of SomeDomainClass?
因为内存分析器“显示分配的对象总数”,并且hprof文件包含堆中活动的对象,这是否表明该应用程序正在创建SomeDomainClass的许多短期实例?
Actually, when you start generating the heap, visualVM
will call the GC
just before start collecting the objects to determine the live objects. 实际上,当您开始生
visualVM
时, visualVM
将在开始收集对象以确定活动对象之前调用GC
。 then collecting them. 然后收集它们。
So if your Heap is not showing any instance of SomeDomainClass
class, then yes the SomeDomainClass
instants are short-live, in other world, these instances didn't have any reference while generating the heap. 因此,如果您的堆没有显示
SomeDomainClass
类的任何实例,那么是的, SomeDomainClass
实例是短暂的,在另一个世界中,这些实例在生SomeDomainClass
时没有任何引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.