Search code examples
javagarbage-collectioneclipse-mat

Java heap dump file (.hprof) is much larger than heap size in eclipse MAT


I have some frequent full GC problems in production with Java, I suspect the memory was allocated by network library for buffering TCP request result.

I have dump the Java heap when the memory usage is high (about 8GB). I tried to analyze the .HPROF file with eclipse MAT, the file is about 8GB.

But in eclipse MAT, the total heap size is about 200 MB, so I could not find which objects are taking up to 8GB heap memory.

Since eclipse MAT is not showing the full heap dump content, I don't know how to find why the application is taking so much memory.


Solution

  • If you are using MAT memory analyzer to open the hprof dump, it may be that the rest of the heap are unreachable objects, which MAT hides by default, see https://stackoverflow.com/a/20405267/3484881