eclipseeclipse-pluginheap-memoryeclipse-memory-analyzermemoryanalyzer

Allocated memory discrepancy between Memory Analyzer and Task Manager


I want to analyze the memory usage of a pretty huge Java VM process.

One thing I realized when firing up the Eclipse Memory Analysis tool is the huge discrepancy between the alleged allocated memory: Windows Task Manager / CMD Tasklist show around 5,5GB while the Memory Analyzer shows only 1,1GB. What's causing that difference?


Solution

  • What the Eclipse Memory Analyzer (MAT) sees and reports is the size of the Java heap, i.e., the object graph that’s made up of Object instances. What the operating system sees and reports is the size of the region in RAM the JVM has requested from the OS to store the Java heap (and its internal data structures) in. This memory is normally not completely filled with live Java objects; some objects may already be dead (and are not seen be MAT) but have not been collected yet, and the garbage collector itself requires some space to move objects around as well.

    I hope this explains the basics (there’s lots more details to both JVM and OS memory management).