Eclipse Mat:understand Incoming and outgoing References

Source: Internet
Author: User

Reference: Http://xmlandmore.blogspot.hk/2014/01/eclipse-mat-understand-incoming-and.html?utm_source=tuicool&utm_ Medium=referral

Saturday, January 25, 2014

Eclipse Mat:understand Incoming and outgoing References

In [1], we had shown how to use OQL to query String instances starting with a specified substring (i.e. , our objects of interest) from a heap dump. [7,8] To determine who's creating these objects, or find out what the purpose of some structures was, an object ' s Inc Oming and outgoing references become handy.

In this article, we'll examine the following topics:

    • What is incoming references or outgoing references of an object?
Then look at both topics related to Incoming References:
    • Path to GC Roots
    • Immediate Dominators

Outgoing References
Using the following OQL statement, we have identified total 7 entries (see figure above) as our objects of Intere St:

SELECT * from java.lang.String WHERE toString (). StartsWith ("http://xmlns.oracle.com/apps/fnd/applcore/log/ Service/types ")
After expanding the first entry, it shows Outgoing References:
    1. A reference to the Class instance for the String object
    2. A reference to an array of char values
Outgoing ReferencesShow the actual contents of the instances, helping to find out their purpose. In our Stringinstance, it holds the references. The memory overhead of this StringInstance is shown in both values: [3]
    • Shallow Heap
    • Retained Heap

These sizes of String instances depends on the internal implementation of the JVM. Read [2,4] for more details. Incoming References
To get incoming references of the first entry, choose List Objects with incoming references fro M the context menu.

Now a tree structure are displayed, showing all instances with all incoming references (note the different icon hi Ghlighted in red). These references has kept the object alive and prevented it from being garbage collected.

Immediate Dominators
Similarly, from the context menu, you can display immediate dominators of the first entry (see figure below). An object X was said to dominate a object y if every path from the GC Root to Y must p The through X. So, the immediate Dominators is a very effective a-to-find out who is keeping a set of objects alive. For example, the immediate dominators of our first entry (note so we have used "java.*|com\.sun\. *' As our filter ' is:

    • Oracle.j2ee.ws.server.deployment.WebServiceEndpoint

Path to GC Roots
From context menu, you can also show 'Path to GC Roots' of the first entry (see figure below). path to GC Roots shows the path to GC Roots which should is found for a given object. As can expect, its immediate dominators must also is on the this path. Note that if you display the Path to GC Roots, you can specify which the fields of the certain classes to being ignored when Finding paths. For example, we had specified that paths through Weak or Soft Reference referents to be excluded.

Live Data Set
Now we know

    • Oracle.j2ee.ws.server.deployment.WebServiceEndpoint
is keeping our StringInstance alive. Instead of viewing Path to GC Roots, it's easier to see it's the other around. We have chosen to display the Outgoing ReferencesOf Webserviceendpointinstance (see figure below). As can see, our StringInstance is displayed as the leaf node of the tree structure.

References

    1. Eclipse mat:querying Heap Objects Using OQL (Xml and more)
    2. Java memory usage of simple data structure
    3. Shallow vs. retained Heap
    4. Create and understand Java Heapdumps (Act 4)
    5. Diagnosing Java.lang.OutOfMemoryError (XML and more)
    6. I Bet you had a Memory Leak in Your application by Nikita Salnikov-tarnovski
      • Classloader leak is the most common leak in Web applications
    7. How to analyze heap dumps
      • Leak can induced
        • Per call (or a class of objects)
        • Per Object
    8. Diagnosing Heap Stress in HotSpot (XML and more)

Posted by XML and more at 10:45 AM

Eclipse Mat:understand Incoming and outgoing References

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.