Comparing "objects allocated" in a JVisualVM snapshot to number of instances in a Java heap dump

StackOverflow https://stackoverflow.com/questions/21754988

  •  11-10-2022
  •  | 
  •  

Frage

I was using JVisualVM to look at an application, and I saw many objects of SomeDomainClass in the memory profiler and snapshot. A Java heap dump (.hprof file) produced shortly thereafter contained no instances of 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?

War es hilfreich?

Lösung

Actually, when you start generating the heap, visualVM will call the GC just before start collecting the objects to determine the live objects. 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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top