Eclipse MAT – Incoming References, Outgoing References

Eclipse MAT – Incoming References, Outgoing References

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’ is one such feature. In this article, let’s discuss ‘incoming references’, ‘outgoing references’ and 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 ‘Incoming References,’ ‘Outgoing References’ and also through an example. Suppose your application’s source code looks like this:

publicclass A {	private C c1 = C.getInstance();}publicclass B {	private C c2 = C.getInstance();	}publicclass C {	privatestatic C myC = newC();	publicstatic C getInstance() {		returnmyC;	}	private D d1 = newD();		private E e1 = newE();	}publicclass D {}publicclass E {}publicclassSimpleExample {	publicstaticvoid main (String argsp[]) throws Exception {			A a = newA();		B b = newB();	}} 

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


Figure 1: Sample application’s objects references

  • Object A and Object B are holding reference to Object C
  • Object C is holding 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 holds references object C is 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 uploaded to Eclipse MAT. Below are the ‘Incoming References’ reported by Eclipse MAT for Object C.

Figure 2: 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 of Object C

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

Below is the ‘Outgoing References’ reported by Eclipse MAT for Object C.

Figure 3: 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 to generate 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 has clarified the differences between ‘Incoming references’ and ‘Outgoing references.’

Author bio: Ram Lakshmanan

ram-lakshshman

Every single day, millions & millions of people in North America — bank, travel, and commerce — use the applications that Ram Lakshmanan has architected. Ram is an acclaimed speaker in major conferences on scalability, availability, and performance topics. Recently, he has founded a startup, which specializes in troubleshooting performance problems.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as