引用: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:

  1. a reference to the Class instance for the String object
  2. 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
  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 Have 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 be induced
      • Per call (or a class of objects)
      • Per object
  8. Diagnosing Heap Stress in HotSpot (Xml and More)

Posted by XML and Moreat 10:45 AM

Eclipse MAT: Understand Incoming and Outgoing References的更多相关文章

  1. Eclipse MAT 安装及使用

    Eclipse MAT官方网页:https://www.eclipse.org/mat/downloads.php 一.MAT是什么? MAT(Memory Analyzer Tool),一个基于Ec ...

  2. Eclipse MAT内存分析工具(Memory Analyzer Tool)

    MAT内存分析工具 MAT是Memory Analyzer的简称,它是一款功能强大的Java堆内存分析器.可以用于查找内存泄露以及查看内存消耗情况.MAT是基于Eclipse开发的,是一款免费的性能分 ...

  3. 【转】Eclipse MAT内存分析工具(Memory Analyzer Tool)

    Eclipse MAT内存分析工具(Memory Analyzer Tool) MAT内存分析工具# MAT是Memory Analyzer的简称,它是一款功能强大的Java堆内存分析器.可以用于查找 ...

  4. 使用AndroidStudio dump heap,再用 Eclipse MAT插件分析内存泄露

    1.eclipse mat插件的安装 Help->Install new software,如下图,一直下一步即可 2.AndroidStudio dump heap 3.AndroidStud ...

  5. java performance tools / NetBeans Profiler / Sun BTrace / Eclipse MAT / IBM ISA

    s Oracel Performace Analyzer NetBeans Profiler Eclipse MAT Sun BTrace IBM ISA end

  6. Eclipse MAT:浅堆 vs 保留堆

    来自:唐尤华 https://dzone.com/articles/eclipse-mat-shallow-heap-retained-heap 有没有想要搞清楚浅堆(Shallow Heap)和保留 ...

  7. 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 ...

  8. 实战分析Tomcat的类加载器结构(使用Eclipse MAT验证)

    一.前言 在各种Tomcat相关书籍,书上都提到了其类加载器结构: 在Tomcat 7或者8中,共享类和Catalina类加载器在catalina.properties中都是没配置的,请看: 所以,c ...

  9. 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. ...

随机推荐

  1. 使用ffmpeg录音

    官方教程:http://ffmpeg.org/ffmpeg.html 录音方法: 开始找到了这个方法,但是不行呀,好像是没有这个oss吧. oss 是linux 下的声音相关的东西,与alsa 一样, ...

  2. MySQL 分区表 partition线上修改分区字段,后续进一步学习partition (1)

    公司线上在用partition,有一个表的分区字段错了,需要重建,结果发现没有办法像修改主键字段或者修改索引字段那样直接一条sql搞定.而是需要建临时表,有down time,所以去仔细看了文档,研究 ...

  3. asp.net跨域上传文件

    前端: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" con ...

  4. HSV颜色识别demo

    HSV(Hue, Saturation, Value)色彩空间是一种区别与RGB的表示形式.其模型可视为一个倒立的棱锥或圆锥. 其中H为色调,用角度度量,取值范围为0°-360°,从红色开始按逆时针方 ...

  5. sqlachemy 使用实例

    sqlachemy 是python中关于sql的ORM,他的存在可以消除底层sql引擎的差异,同事也避免了复杂繁琐的sql语句,因此我们在比较大的应用时常使用它,下面是我写的一个例子 #!/usr/b ...

  6. git新手碰到的各种奇葩问题之一

    git  操作错误: <1>.情景描述:当在git commit --amend 更新上一次提交时,而此时提交日志会跳转到别人的日志中.,会出现错误:如下 弥补操作: 1.git fetc ...

  7. Android Studio builde.gradle 配置说明

    //声明是Android应用程序 apply plugin: 'com.android.application' android { //编译SDK版本 compileSdkVersion 21 bu ...

  8. 防止DC电源反接的方法——SS14的用法

    出处:http://blog.ednchina.com/tengjingshu 电源是PCB板的重要部分,每个芯片都需要电源供给.芯片其实是挺脆弱的,只要正负接反得话,大多数就会挂掉,相信很多人都有惨 ...

  9. windows批处理命令教程

      批处理文件是无格式的文本文件,它包含一条或多条命令.它的文件扩展名为 .bat 或 .cmd.在命令提示下键入批处理文件的名称,或者双击该批处理文件,系统就会调用Cmd.exe按照该文件中各个命令 ...

  10. 自制单片机之十一……模数转换IC ADC0809

    我们重在实际制做,太罗嗦的内容我就不说了,只讲些跟制做有关的最精炼的知识. ADC0809是可以将我们要测量的模拟电压信号量转换为数字量从而可以进行存储或显示的一种转换IC.下面是它的管脚图和逻辑图: ...