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
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
View Events Video Library
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
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

[DZone Research] Observability + Performance: We want to hear your experience and insights. Join us for our annual survey (enter to win $$).

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Eclipse MAT: Shallow Heap Vs. Retained Heap
  • Eclipse JNoSQL 1.0.2: Empowering Java With NoSQL Database Flexibility
  • Understanding Git
  • Creating a Deep vs. Shallow Copy of an Object in Java

Trending

  • A Guide to Data-Driven Design and Architecture
  • Monkey-Patching in Java
  • Demystifying Project Loom: A Guide to Lightweight Threads in Java
  • Revolutionizing Software Testing
  1. DZone
  2. Coding
  3. Frameworks
  4. Eclipse MAT — Incoming, Outgoing References

Eclipse MAT — Incoming, Outgoing References

Check out the differences between incoming and outgoing references in Eclipse MAT.

Ram Lakshmanan user avatar by
Ram Lakshmanan
CORE ·
Feb. 19, 19 · Presentation
Like (7)
Save
Tweet
Share
17.42K Views

Join the DZone community and get the full member experience.

Join For Free

Eclipse Memory Analyzer (MAT) is a powerful tool for heap dump analysis. It has several great features to debug memory problems effectively. ‘Incoming references’ and ‘outgoing references’ are one such feature. In this article, let’s discuss incoming references, outgoing references, and the difference between them.

In Eclipse MAT, when you right click on any object, you will see drop down menu. If you select ‘List Objects’ menu item, you will notice two options:

  • with outgoing references
  • with incoming references

As it’s easier to understand new concepts through examples. Let’s learn more about incoming references and outgoing references through an example. Say your application’s source code looks like this:

public class A {
     private C c1 = C.getInstance();
}
public class B {
     private C c2 = C.getInstance();
}
public class C {
     private static C myC = new C();
     public static C getInstance() {
             return myC;
     }
     private D d1 = new D();
     private E e1 = new E();
}
public class D {
}
public class E {
}
public class SimpleExample {
     public static void main (String argsp[]) throws Exception {
            A a = new A();
            B b = new B();
     }
}


Now, if we are going draw the objects diagrammatically for the above example application, it’s going to look like this:

object-model

Fig: Sample application’s objects references
  • Object A and Object B are holding a reference to Object C
  • Object C is holding a reference to Object D and Object E

Now, in this sample project, let’s study the incoming references and outgoing references of object C.

Incoming References of Object C

All the objects that hold references to object C are called incoming references. In this example, Object C’s incoming references are object A, object B, and class C.

To confirm this theory, we captured heap dump from the above sample application and upload it to Eclipse MAT. Below are the incoming references reported by Eclipse MAT for Object C.

eclipse-mat-incoming-reference-v2

Fig: Incoming references of Object C

When you right-click on Object C in the ‘Dominator Tree’ and select ‘List Objects > with incoming references’ option, you will notice that Eclipse MAT generates the above report. You can notice Object A, Object B, and class C reported as incoming references. Eclipse MAT also displays the variables used to reference Object C. You can see object A referencing object C using the variable ‘c1.’ Similarly, other variables used to reference object C are also reported.

Outgoing References for Object C

All the objects that Object C references are called outgoing references. In this example, Object C’s outgoing references are object D, object E and class C.

Below are the outgoing references reported by Eclipse MAT for Object C.

eclipse-mat-outgoing-reference-v2

Fig: Outgoing references of Object C

When you right-click on Object C in the ‘Dominator Tree’ and select ‘List Objects > with outgoing references’ option, you will notice Eclipse MAT generates the above report. You can notice Object D, Object E, and class C reported as incoming references. Eclipse MAT also displays the variables by Object C to reference other objects. You can see object C referencing object D using the variable ‘d1.’ Similarly, other variables used in object C are also reported.

We hope this article might have clarified the difference between incoming references and outgoing references. To more learn about the difference between heaps, check out this article on the difference between shallow heap and retained heap for further reading.

Object (computer science) Eclipse

Opinions expressed by DZone contributors are their own.

Related

  • Eclipse MAT: Shallow Heap Vs. Retained Heap
  • Eclipse JNoSQL 1.0.2: Empowering Java With NoSQL Database Flexibility
  • Understanding Git
  • Creating a Deep vs. Shallow Copy of an Object in Java

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

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: