Skip to content
Advertisement

java process hangs, jvisualvm shows the process is using the all of the heap space

My java process hangs. It reads input data and parses it into Integer[] and write them into disks.

jvisualvm shows the process is fully using the heap space. (java.lang.Integer and java.lang.Integer[] use 77% and 22% of the heap space respecitvely)

AFAIK the java process dies showing OutOfMemory error messages when the memory capacity is not enough.

Why my process hangs there? How can I resolve this issue?

Advertisement

Answer

Assuming that you have a full heap dump, what you will want to do is calculate the fully retained sizes of your objects. This will tell you the full size of all instances of your class, including the other objects to which it’s holding a reference. Take the largest ones and start from there.

Retained sizes in Visual VM

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement