Eclipse MAT: Understand Incoming and Outgoing References
引用: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 have 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 is creating these objects, or find out what the purpose of some structures are, an object's incoming and outgoing references become handy.
In this article, we will examine the following topics:
- What are incoming references or outgoing references of an object?
Then look at two 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 interest:
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 two outgoing references:
- a reference to the Class instance for the String object
- a reference to an array of char values
Outgoing References show the actual contents of the instances, helping to find out their purpose. In our String instance, it holds two references. The memory overhead of this String instance is shown in two 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 from the context menu.
Now a tree structure is displayed, showing all instances with all incoming references (note the different icon highlighted in red). These references have 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 is said to dominate an Object Y if every path from the GC Root to Y must pass through X. So, immediate dominators is a very effective way to find out who is keeping a set of objects alive. For example, the immediate dominators of our first entry (note that 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 be found for a given object. As you can expect, its immediate dominators must also be on this path. Note that, when you display Path to GC Roots, you can specify which fields of certain classes to be ignored when finding paths. For example, we have 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 String instance alive. Instead of viewing Path to GC Roots, it is easier to see it the other way around. So, we have chosen to display the outgoing references of WebServiceEndpoint instance (see Figure below). As you can see, our String instance is displayed as the leaf node of the tree structure.

References
- Eclipse MAT: Querying Heap Objects Using OQL (Xml and More)
- Java memory usage of simple data structure
- Shallow vs. Retained Heap
- Create and Understand Java Heapdumps (Act 4)
- Diagnosing Java.lang.OutOfMemoryError (Xml and More)
- I Bet You Have a Memory Leak in Your Application by Nikita Salnikov-Tarnovski
- Classloader leak is the most common leak in web applications
- How to analyze heap dumps
- Leak can be induced
- Per call (or a class of objects)
- Per object
- Leak can be induced
- Diagnosing Heap Stress in HotSpot (Xml and More)
Posted by XML and Moreat 10:45 AM
Eclipse MAT: Understand Incoming and Outgoing References的更多相关文章
- Eclipse MAT 安装及使用
Eclipse MAT官方网页:https://www.eclipse.org/mat/downloads.php 一.MAT是什么? MAT(Memory Analyzer Tool),一个基于Ec ...
- Eclipse MAT内存分析工具(Memory Analyzer Tool)
MAT内存分析工具 MAT是Memory Analyzer的简称,它是一款功能强大的Java堆内存分析器.可以用于查找内存泄露以及查看内存消耗情况.MAT是基于Eclipse开发的,是一款免费的性能分 ...
- 【转】Eclipse MAT内存分析工具(Memory Analyzer Tool)
Eclipse MAT内存分析工具(Memory Analyzer Tool) MAT内存分析工具# MAT是Memory Analyzer的简称,它是一款功能强大的Java堆内存分析器.可以用于查找 ...
- 使用AndroidStudio dump heap,再用 Eclipse MAT插件分析内存泄露
1.eclipse mat插件的安装 Help->Install new software,如下图,一直下一步即可 2.AndroidStudio dump heap 3.AndroidStud ...
- java performance tools / NetBeans Profiler / Sun BTrace / Eclipse MAT / IBM ISA
s Oracel Performace Analyzer NetBeans Profiler Eclipse MAT Sun BTrace IBM ISA end
- Eclipse MAT:浅堆 vs 保留堆
来自:唐尤华 https://dzone.com/articles/eclipse-mat-shallow-heap-retained-heap 有没有想要搞清楚浅堆(Shallow Heap)和保留 ...
- Tasker to auto record incoming or outgoing call
Tasker to auto record incoming or outgoing call most of time, i was thinking of tasker can do the jo ...
- 实战分析Tomcat的类加载器结构(使用Eclipse MAT验证)
一.前言 在各种Tomcat相关书籍,书上都提到了其类加载器结构: 在Tomcat 7或者8中,共享类和Catalina类加载器在catalina.properties中都是没配置的,请看: 所以,c ...
- Go Concurrency Patterns: Context At Google, we require that Go programmers pass a Context parameter as the first argument to every function on the call path between incoming and outgoing requests.
小结: 1. Background is the root of any Context tree; it is never canceled: 2. https://blog.golang. ...
随机推荐
- POJ3484 Showstopper (二分+字符串处理)
POJ3484 Showstopper 题目大意: 每次给出三个数x,y,z,用这三个数构成一个等差数列,x为首项,y是末项,z是公差 总共给出n组x,y,z( n待定),求这n组数列中出现次数为奇数 ...
- JS将毫秒转换成时间格式
JavaScript Date(日期)对象 实例 getTime():返回从 1970 年 1 月 1 日至今的毫秒数. setFullYear(): 设置具体的日期. toUTCString():将 ...
- jquery1.9学习笔记 之层级选择器(三)
下一个相邻选择器(“prev + next”) 描述:选择所有给出祖先选择器的子孙选择器. 例子: <!doctype html> <html lang='zh'> <h ...
- Python新手学习基础之条件语句——elif语句
elif语句 (相当于C语言的else if) 在Python中,当我们需要有更多的判断条件时,我们往往会使用另外一种语法表达,即使用elif: if 判断条件1: 执行语句1 elif 判断条件2: ...
- HTML&CSS基础学习笔记1.18-表格的边框
今天的内容比较简单~来看看HTML里表格的边框是怎么设置的吧 表格的边框 前面为了方便观察表格单元格的情况,我们给<table>加了border属性.<table>的borde ...
- Python学习笔记总结(一)对象和流程语句总结
一.对象类型 1.数字 数字:不可变 2.字符串 字符串:不可原处修改[修改需要创建新的对象],有顺序,支持求长(len),合并(+),重复(*),索引S[0],分片(S[1:3]],成员测试(in) ...
- BZOJ 2115: [Wc2011] Xor
2115: [Wc2011] Xor Time Limit: 10 Sec Memory Limit: 259 MB Submit: 2794 Solved: 1184 [Submit][Stat ...
- Python 在Visual studio 中做单元测试进行TDD开发
Unit Tests Steve Dower edited this page on 14 Jul · 3 revisions Pages 38 Home Azure Remote Debugging ...
- iptables 顺序
-A INPUT -s 115.236.6.6/32 -p udp -m udp --dport 111 -j ACCEPT -A INPUT -s 10.175.197.98/32 -p udp - ...
- 只允许指定的ip访问本机的指定端口22:
只允许指定的ip访问本机的指定端口22: 允许的的ip:192.168.1.123, 192.168.1.124, 192.168.1.100,其他ip都禁止访问. 切换到root用户 1.在tcp协 ...