Reputation: 1145
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
Upvotes: 1
Views: 5084
Reputation: 1180
VisualVM absolutely supports viewing and inspecting live objects via a Heap Dump, as well as live sampled allocations.
For the heap dump right click the process, select Heap Dump.
This opens the Heap Dump view. On the Summary page you can calculate the n biggest objects by retained size, then click through to various views.
It provides essentially the same functionality as using jmap and mat as suggested above, but with vastly nicer workflow and usability.
Upvotes: 6
Reputation: 13696
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.
Upvotes: 4