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
Newsletter
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

  • ScyllaDB in Enterprise Java: High-Performance NoSQL With Eclipse JNoSQL
  • Taming Parameter Sniffing in SQL Server 2022 With PSP Optimization
  • Evals in CI: How to Catch Agent Regressions Before Production Does
  • PWA on iOS, Part 2: HTTPS, Manifest and Service Worker

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
DZone Core CORE ·
Apr. 15, 21 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
6.9K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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