java oql_深入理解java虚拟机(八):java内存分析工具-MAT和OQL

以下内容翻译自MAT帮助文档。

一、Class Histogram

Class Histogram shows the classes found in the snapshot, the number of objects for each class, the heap memory consumption of these  objects, and the minimum retained size of the objects

二、Dominator tree

Dominator tree shows for a particular object which other objects depend on it and will be garbage collected if that particular object becomes unreachable.

三、Paths to GC roots

This view find objects responsible for keeping the selected object in the heap.

Componenet report A heap dump contains many objects. But which of those belong to your component? And what conclusions can you draw from them? This is where the Component Report can help。

四、OQL

OQL is the build-in object query language. Learn to perform custom SQL-like queries on the heap dump in one minute. classes as tables, objects as rows, and fields as columns。

1、OQL-SELECT

1.SELECT * FROM java.lang.String

2.SELECT toString(s), s.count, s.value FROM java.lang.String s

3.SELECT toString(s) AS Value,s.@usedHeapSize AS “Shallow Size” FROM java.lang.String s

(@为属性访问器,可以使用AS起个别名)

4.SELECT AS RETAINED SET * FROM java.lang.String

(使用AS RETAINED SET 获得与选择对象相关联的对象集合)

5.SELECT OBJECTS dominators(s) FROM java.lang.String s

(OBJECTS 关键字使得dominators 返回二维数组简化为一维对象列表)

6.SELECT DISTINCT OBJECTS classof(s) FROM java.lang.String s

(DISTINCT 去重复)

7、查询所有的异常对象SELECT * FROM INSTANCEOF java.lang.Exception exceptions

SELECT exceptions.@displayName, exceptions.detailMessage.toString() FROM INSTANCEOF java.lang.Exception exceptions

2、OQL-FROM

1.SELECT * FROM “java\.lang\..*”

(支持正则)

2.SELECT * FROM java.lang.String

3.SELECT * FROM 0xe14a100

(根据类对象在堆转储快照中的地址查询)

4.SELECT * FROM 3022

(根据对象在堆转储快照中的地址ID)

5.SELECT * FROM ( SELECT * FROM java.lang.Class c )

6.SELECT * FROM ${snapshot}.getClasses()(使用属性访问器)

7.SELECT * FROM INSTANCEOF java.lang.ref.Reference

(INSTANCEOF会把指定类的子类也查询出来)

8.SELECT * FROM OBJECTS java.lang.String

(OBJECTS禁止OQL把查询范围解释为对象实例,上述结果为java.lang.String对应的Class)

3、OQL-WHERE

1.SELECT * FROM java.lang.String s WHERE s.count >= 100

2.SELECT * FROM java.lang.String s WHERE toString(s) LIKE “.*day”

3.SELECT * FROM java.lang.String s WHERE s.value NOT IN dominators(s)

4.SELECT * FROM java.lang.String s WHERE toString(s) = “monday”

5.SELECT * FROM java.lang.String s WHERE s.count > 100 AND s.@retainedHeapSize > s.@usedHeapSize

6.SELECT * FROM java.lang.String s WHERE s.count > 1000 OR s.value.@length >1000

7.SELECT * FROM java.lang.String s WHERE (s.count > 1000) = true

WHERE toString(s) = “monday”

WHERE dominators(s).size() = 0

WHERE s.retainedHeapSize > 1024L

WHERE s.@GCRootInfo != null

4、属性访问器

1.[.]..……

(访问堆转储快照中对象的字段)

2.[.]@……

(访问java bean属性)

目标

接口

属性

含义

任意堆中的对象

Iobject

objectId

快照中对象的ID

objectAddress

快照中对象的地址

Class

对象所属的类

usedHeapSize

对象的shallowSize

retainedHeapSize

对象的retainedSize

displayName

对象的显示名称

类对象

Iclass

classLoaderId

类加载器Id

任意数组

Iarray

length

数组的长度

5、OQL 内建函数

.[.]@([,])……

(调用OQL java方法,加“()”会令MAT解释为一个OQL java调用)

常见的OQL java方法

目标

接口

属性

含义

$snapshot

Isnapshot

getClasses()

获取所有类的集合

getClassesByName(String name,boolean includeSubClasses)

获取指定类的集合

Class object

Iclass

hasSuperClass()

如果对象有父类则返回true

isArrayType()

如果Class是数组类型则返回true

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/541462.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《Python数据分析与挖掘实战》一1.2 从餐饮服务到数据挖掘

本节书摘来自华章出版社《Python数据分析与挖掘实战》一书中的第1章,第1.2节,作者 张良均 王路 谭立云 苏剑林,更多章节内容可以访问云栖社区“华章计算机”公众号查看 1.2 从餐饮服务到数据挖掘 企业经营最大的目的就是盈利,而餐…

obj[]与obj._Ruby中带有示例的Array.include?(obj)方法

obj[]与obj.Ruby Array.include&#xff1f;(obj)方法 (Ruby Array.include?(obj) Method) In the previous articles, we have seen how we can check whether two Array instances are identical or not with the help of <> operator, operator, and .eql? method?…

java javah_Java开发网 - 一个javah的问题

Posted by:jerry_xuPosted on:2006-03-13 15:39我在环境变量中已经设置了path为D:\Program Files\Java\jdk1.5.0_06&#xff0c;ClassPath设置为.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;class的路径为&#xff1a;D:\JNItest\bin\jni\Hello.class &#xff0c;但是…

《Python面向对象编程指南》——2.7 __del__()方法

本节书摘来自异步社区《Python面向对象编程指南》一书中的第2章&#xff0c;第2.7节&#xff0c;作者&#xff3b;美&#xff3d;Steven F. Lott&#xff0c; 张心韬 兰亮 译&#xff0c;更多章节内容可以访问云栖社区“异步社区”公众号查看。 2.7 __del__()方法 __del__()方…

NullReferenceException C#中的异常

什么是NullReferenceException&#xff1f; (What is NullReferenceException?) NullReferenceException is an exception and it throws when the code is trying to access a reference that is not referencing to any object. If a reference variable/object is not refe…

java map key 大写转小写_Spring JdbcTemplate 查询出的Map,是如何产生大小写忽略的Key的?(转)...

Java 是区分大小写的&#xff0c;普通的Map例如HashMap如果其中的key"ABC" value"XXX"那么map.get("Abc") 或 map.get("abc")是获取不到值得。但Spring中产生了一个忽略大小写的map使我产生了好奇例如 jdbcTemplate.queryForList(sql)…

《iOS 6核心开发手册(第4版)》——2.11节秘诀:构建星星滑块

本节书摘来自异步社区《iOS 6核心开发手册&#xff08;第4版&#xff09;》一书中的第2章&#xff0c;第2.11节秘诀&#xff1a;构建星星滑块&#xff0c;作者 【美】Erica Sadun&#xff0c;更多章节内容可以访问云栖社区“异步社区”公众号查看 2.11 秘诀&#xff1a;构建星星…

css框架和js框架_优雅设计的顶级CSS框架

css框架和js框架Brief discussion: 简要讨论&#xff1a; Well, who doesnt want their website or web page to look attractive, stylish and be responsive? 那么&#xff0c;谁不希望自己的网站或网页看起来有吸引力&#xff0c;时尚并且ReactSwift&#xff1f; We put …

软考下午题具体解释---数据流图设计

在历年的软考下午题其中&#xff0c;有五道大题。各自是数据流图的设计&#xff0c;数据库设计&#xff0c;uml图&#xff0c;算法和设计模式&#xff0c;从今天这篇博文開始&#xff0c;小编就跟大家来一起学习软考下午题的相关内容。包含理论上的知识以及典型例题的解说&…

基本程序 打印Scala的Hello World

Scala中的基本程序 (Basic program in Scala) As your first Scala program, we will see a basic output program that just prints "Hello World" or any other similar type of string. With this example, we will see what are the part of the code that is im…

java treemap lastkey_Java TreeMap lastKey()用法及代码示例

java.util.TreeMap.lastKey()用于检索Map中存在的最后一个或最高键。用法:tree_map.lastKey()参数&#xff1a;该方法不带任何参数。返回值&#xff1a;该方法返回映射中存在的最后一个键。异常&#xff1a;如果映射为空&#xff0c;则该方法将引发NoSuchElementException。以下…

mysql属于数据库三级模式_数据库系统的三级模式指的是什么

数据库系统的三级模式指的是什么发布时间&#xff1a;2020-10-26 10:11:21来源&#xff1a;亿速云阅读&#xff1a;52作者&#xff1a;小新小编给大家分享一下数据库系统的三级模式指的是什么&#xff0c;希望大家阅读完这篇文章后大所收获&#xff0c;下面让我们一起去探讨吧&…

《自顶向下网络设计(第3版)》——导读

目录 第1部分 辨明客户的需求和目标 第1章 分析商业目标和制约 1.1 采用自顶向下的网络设计方法 1.2 分析商业目标 1.3 分析商业制约 1.4 商业目标检查表 1.5 小结 1.6 复习题 1.7 设计环境 第2章 分析技术目标与折衷措施 2.1 可扩展性 2.2 可用性 2.3 网络性能 2.4 安全性 2…

python矩阵变化_用numpy改变矩阵的形状

我的问题有两个方面。我有下面的代码来处理一些矩阵。在import numpytupleList [(0, 122), (1, 246), (2, 157), (3, 166), (4, 315), (5, 108), (6, 172), (7, 20), (8, 173), (9, 38), (10, 28), (11, 72), (12, 102), (13, 277), (14, 318), (15, 316), (16, 283), (17, 31…

最小硬币问题_进行更改的最小硬币数量

最小硬币问题Description: 描述&#xff1a; This is classic dynamic programming problem to find minimum number of coins to make a change. This problem has been featured in interview rounds of Amazon, Morgan Stanley, Paytm, Samsung etc. 这是经典的动态编程问题…

java 生成xml乱码_jdom解决中文乱码问题 JAVA生成xml文件帮了我很大的忙

决解了数据库读取出来 再保存到xml 产生的乱码问题import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import org.jdom.Attribute;import org.jdom.Document;import org.jdom.Element;import org.jdom.output.Format;import org.…

给定重量上限,背包问题_满足给定重量的袋子的最低成本

给定重量上限,背包问题Problem statement: 问题陈述&#xff1a; You are given a bag of size W kg and you are provided costs of packets different weights of oranges in array cost[] where cost[i] is basically cost of i kg packet of oranges. cost[i] -1 means t…

springMVC rest风格

1.dispatcherServlet的配置<!-- The front controller of this Spring Web application, responsible for handling all application requests --><servlet><servlet-name>springDispatcherServlet</servlet-name><servlet-class>org.springfram…

sql2008能否打开mysql数据库_mysql数据库数据能不能导入到sql server中

点“测试”按钮确认你的链接是正确的。 Press the "Test" button to ensure your connection settings are set properly and then the "OK" button when youre done.二. 创建Microsoft SQL到MySQL的链接1.在SQL Server Management Studio中打开一个new qu…

c语言 函数的参数传递示例_isunordered()函数与C ++中的示例

c语言 函数的参数传递示例C isunordered()函数 (C isunordered() function) isunordered() function is a library function of cmath header, it is used to check whether the given values are unordered (if one or both values are Not-A-Number (NaN)), then they are u…