Monday, 2 December 2024

JVM  Profiling with Eclipse MAT

JVM Profiling refers to the process of analyzing the performance and behavior of applications running on the Java Virtual Machine (JVM).






Heap Memory Issue




Eclipse Memory Analyzer Tool (MAT)

powerful Java heap analyzer that helps you identify memory leaks and optimize memory usage in Java applications.

  • Heap Dump Analysis
  • Leak Suspects Report
  • Retained Sizes Calculation
  • Memory Consumption Patterns

Shallow Heap: The shallow heap of an object is the amount of memory that is directly allocated for that object. 

Retained Heap: The retained heap of an object is the amount of memory that will be freed when the object is garbage collected. It includes the shallow heap of the object and the shallow heap of all objects that are reachable only from that object. 




Dominator Tree

A dominator tree is a representation of the object graph where each node (object) is dominated by its parent. An object X is said to dominate an object Y if every path from the root to Y must pass through X1.
Purpose: The dominator tree helps you identify the largest chunks of retained memory and understand the keep-alive dependencies among objects.


Path to GC





Eclipse MAT configuration




How to create Heap Dump


Configure below VM argument while running the java application

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:/Users/xxxx/myapps/perf/heapdump -Xmx512m

Important Reports in MAT


Leak Report



Histogram Report




Dominator Report




Details on analysis can be found below

Heap Exhaustion – Memory Leak





No comments:

Post a Comment

Streaming with Kafka API

The Kafka Streams API is a Java library for building real-time applications and microservices that efficiently process and analyze large-sca...