Search code examples
javaprofilingjvisualvm

jvisualvm -how to see live objects with memory consumption


I am trying to use JVisualVM to see my applications live objects and their corresponding memory count (probably at the package level)

How do I achieve the same when I connect using a jstad connection

Thanks


Solution

  • I am pretty sure you cannot do that with VisualVM against a running process. What you need to do is to take a heap dump using jmap (e.g. jmap -dump:format=b,file=heapdump.bin) and then use a tool like mat to analyze that dump.

    Be aware that the heap dump will block your process for considerable time, especially if you have a large heap.

    What you also can do to get information on a more general level is to run jmap -histo:live against your process to see just the number of objects of each type and their footprints.