How to use Eclipse Memory Analyzer(MAT)

Published by

on

If you add -XX:+HeapDumpOnOutOfMemoryError on the JVM argument, when OOM occurs it’ll leave a heap dump.

How to use MAT to analyze heap dump file

  1. After opening up the .hprof file, you’ll see below overview
  2. Dominator Tree will show what’s consuming most of the heap spaces
    • Shallow Heap: The size of the object itself
    • Retained Heap: The size of the other objects that it is referring
  3. Leak Suspects will show suspicious thread and the stacktraces
  4. Histogram will show list of objects by class. Using histogram, we can get a clue of suspects

Reference

Leave a comment