Skip to content
Advertisement

Can heap dump be created for analyzing memory leak without garbage collection?

We have some memory leak issues on VMs in production which are running Java applications, the Old Gen heap usage grows fast every day, so I want to create heap dump to analyze it.

However, I noticed that VisualVM will perform full GC before heap dump which will clean the Old Gen, in that case, the heap dump would be useless.

I also tried to use the following command:

jmap -dump:live,format=b,file=heap.bin

It will also trigger a full GC.

May I ask if there is a way that heap dump can be created without full GC (or without GC)? Or is there any better way to analyze the memory leak?

JDK version: 1.7.0_45

Thanks.

Advertisement

Answer

To create a heap dump, there will be a Full GC. The same applies when creating Class histogram out of heap.

If you want to analyze memory leak between Full GCs, then probably memory profiling using a Java profiler (Mission Control, jProfiler, etc) is your only option.

See this Q/A for Java Mission Control Heap Profile.

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