Execute heap dump in remote Java 8+ JVM without first executing a Garbage Collecting

161 Views Asked by At

I am using VisualVM to extract a Heap Dump from a tomcat that is consuming a lot of memory resources. It starts consuming around 1GB but gradually reaches 5-6GB. It has peaks where the CPU is at 100% and where the memory is close to 99%.

I am trying to investigate this event by extracting heap dump, but every time I run a Heap Dump with the VisualVM software it runs a full Garbage Collection first which causes the heap memory to go from 5-6GB at the time of the request to around 1GB, and the heap dump extract that it extracts is 1GB, when I want it to extract the extract from the moment before the GC

Reading this thread How can I take a heap dump on Java 5 without garbage collecting first? I have seen that I should use the value of "live" to false to prevent this from happening, but I can't find how to do it in VisualVM. I am connecting to the server using an SSH connection and tunneling, so the remote server does not have JDK installed.

How can I extract the entire heap dump remotely? Any advice to deal with this memory consumption? I am investigating the code in case there could be an error that causes consumption, but the fact that when a full GC is run the memory is restored to normal levels makes me suspicious.

0

There are 0 best solutions below