DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Trending

  • Building a Production-Ready AI Agent in 2026: Beyond the Hello World Demo
  • S3 Vectors: How to Build a RAG Without a Vector Database
  • The Hidden Bottlenecks That Break Microservices in Production
  • Visualizing Matrix Multiplication as a Linear Combination
  1. DZone
  2. Coding
  3. Frameworks
  4. Eclipse MAT: Tidbits

Eclipse MAT: Tidbits

Eclipse MAT is a great JVM Memory Analysis tool. Here are a few tidbits to use it effectively. I would highly recommend installing a Stand-alone version.

By 
Ram Lakshmanan user avatar
Ram Lakshmanan
DZone Core CORE ·
Apr. 15, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
6.7K Views

Join the DZone community and get the full member experience.

Join For Free

Eclipse MAT is a great JVM Memory Analysis tool. Here are a few tidbits to use it effectively.

JVM Memory Analysis

Fig: Eclipse MAT.

1. Use Stand-alone Version

Two versions of Eclipse MAT is available:

  1. Stand-alone.
  2. Eclipse Plugin.

Based on my personnel experience, the stand-alone version seems to works better and faster than the plugin version. So I would highly recommend installing a Stand-alone version.

2. Eclipse MAT — Heap Size

If you are analyzing a heap dump of size say 2 GB, allocate at least 1 GB additional space for Eclipse MAT. If you can allocate more heap space then it's more the merrier. You can allocate additional heap space for the Eclipse MAT tool, by editing the MemoryAnalyzer.ini file. This file is located in the same folder where MemoryAnalyzer.exe is present. To the MemoryAnalyzer.ni you will add -Xmx3g at the bottom.

Example:

-startup 
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
--launcher.library 
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326 
-vmargs -Xmx3g


3. Enable 'Keep Unreachable Objects'

From its reporting, Eclipse MAT removes the object which it thinks is 'unreachable.' As 'unreachable,' objects are eligible for garbage collection, and MAT doesn't display them in the report. Eclipse MAT classifies Local variables in a method as 'unreachable objects'. Once the thread exits the method, objects in local variables will be eligible for garbage collection.

However, there are several cases where the thread will go into a 'BLOCKED' or prolonged 'WAITING,' 'TIMED_WAITING' state. In such circumstances local variables will be still alive in memory, occupying space. Since Eclipse MAT default settings don't show the unreachable objects, you will not get visibility into these objects. You can change the default settings in Eclipse MAT 1.4.0 version by:

1. Go to Window > Preferences …

2. Click on 'Memory Analyzer.'

3. Select 'Keep unreachable objects.'

4. Click on 'OK' button.


Enable ‘Keep unreachable objects’

Fig: Eclipse MAT 1.4.0, showing how to enable 'Keep unreachable objects.'

4. Smart Data Settings

Eclipse MAT by default displays data in bytes. It's difficult to read large object sizes in bytes and digest them. Example Eclipse MAT prints object size like this: '193,006,368.' It's much easier if this data can be displayed in KB, MB, GB, i.e., '184.07 MB.'

Showing Object Size in Bytes

Fig: Eclipse MAT default option showing object size in bytes.

Eclipse MAT provides an option to display object size in KB, MB, GB based on their appropriate size. It can be enabled by following the below steps:

  1. Go to Window > Preferences …
  2. Click on 'Memory Analyzer.'
  3. In the 'Bytes Display' section select 'Smart: If the value is a gigabyte or …'
  4. Click on the 'OK' button.

Settings to enable ‘smart’ data display

Fig: Settings to enable 'smart' data display.

Once this setting change is made, all data will appear in much more readable KB, MB, GB format, as shown in the below figure.

Eclipse MAT displaying object size in KB, MB, GB

Fig: Eclipse MAT displaying object size in KB, MB, GB after enabling 'smart' settings.

Eclipse

Opinions expressed by DZone contributors are their own.

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook