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 Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Languages
  4. Comparing Heap Dumps with NetBeans 7.1

Comparing Heap Dumps with NetBeans 7.1

Dustin Marx user avatar by
Dustin Marx
·
Jan. 20, 12 · Interview
Like (0)
Save
Tweet
Share
5.95K Views

Join the DZone community and get the full member experience.

Join For Free

One of the "new and noteworthy" features of NetBeans 7.1 is the ability to compare two heap dumps. Specifically, the easy-to-use feature allows one to quickly ascertain the difference in number of each class's instances between two dump files. This brief post shows how easy it is to use.

Heap dumps can be generated in a variety of ways. For purposes of this post, I have created two heap dumps on two totally separate applications using the Oracle JDK-provided jmap (Java Memory Map) tool to attach to the processes's Java PIDs and create heap dumps (creatively named Heap1.map and Heap2.map in my example). It's probably not useful in most cases to compare heap dumps of two entirely different applications. I only do so in this example to make the differences calculated in the comparison results obvious.

The next screen snapshot shows NetBeans 7.1 started with the option "Load heap dump..." being selected under the "Profile" menu. This is done to load the first heap dump of the two to be compared.

The next screen image shows the results of selecting "Load heap dump..." (the popup titled "Open Heap Dump File") and indicates selecting one of the heap dumps (Heap1.map).

The next screen snapshot shows how NetBeans 7.1 looks with the selected heap dump displayed with the "Summary" tab in focus.

The last image showed the heap file loaded in NetBeans 7.1 with the "Summary" tab in focus. The next image is a snapshot of the IDE switched to the "Classes" tab in the heap dump report area.

The last image indicates that NetBeans shows the number of instances of different classes in the Java application whose heap dump is being analyzed. By default, the instances are listed in descending order of number of instances, but one can click on the "Size" column header to sort by total size. Just above the column headings "Instances" and "Size" is a link that says, "Compare with another heap dump" and that is the main focus of this post.

Clicking on the "Compare with another heap dump" link in the "Classes" tab of NetBeans 7.1's heap dump analysis tool leads to a popup ("Select Heap Dump to Compare") for selecting the second heap dump to be compared. This is indicated in the next screen snapshot.

In my example, I had two other heap dump files in the same directory as the originally selected one (Heap2.map and Heap3.map). Selecting Heap3.map leads to the comparison being made. This can take a few seconds for the NetBeans IDE to update the representation and it might be worth moving the scroll bar on the right down and back up to make sure it has updated. The next two screen snapshots show the comparison displayed with the first screen snapshot showing the types for which the first heap dump has more instances than the other (top) and the second image showing the types for which the second heap dump has more instances than the other (bottom).

The + and - signs indicate the number of instances greater (+) or fewer (-) in the first heap dump file analyzed (Heap1.map) as compared to that of the second heap dump file analyzed (Heap3.map). In other words, types with positive numbers have more instances represented in the originally loaded heap dump and types wiuth negative numbers have fewer instances represented in the originally loaded heap dump.

When comparing two separate applications, this doesn't provide much that's interesting other than to illustrate the tool. However, given two instances of the same application at the same execution point with different context or data sets might prove more interesting when comparing heap dumps. Perhaps the most enlightening use of this tool is for comparing heap dumps taken from the same application at different points in its execution. With NetBeans 7.1, it is easy to rapidly determine the difference between two heap dumps in terms of instances loaded at the time each heap dump was taken. When it's the delta or difference that matters, this tool can be useful.

 

From http://marxsoftware.blogspot.com/2012/01/comparing-heap-dumps-with-netbeans-71.html

Dump (program) garbage collection NetBeans

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Multi-Tenant Architecture for a SaaS Application on AWS
  • Seamless Integration of Azure Functions With SQL Server: A Developer's Perspective
  • Create a CLI Chatbot With the ChatGPT API and Node.js
  • Old School or Still Cool? Top Reasons To Choose ETL Over ELT

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: