首页  

MAT内存分析之OQL     所属分类 MAT 浏览量 131
Memory Analyzer allows to query the heap dump with custom SQL-like queries. 
OQL represents classes as tables, objects as rows, and fields as columns.


Object Query Language

SELECT *
FROM [ INSTANCEOF ] $classname [ WHERE $filter-expression ]

不同的ClassLoader载入同样名字的类是不同的类型 
instanceof  含子类
obj.fieldName 访问字段, array[index] 访问数组元素


select * from "java.lang.*"
SELECT * FROM java.lang.String


选中对象 (可多个)右键   copy  / OQL query

SELECT * FROM OBJECTS 7135,7130

SELECT * FROM java.lang.String s WHERE  s.value.@length > 100

SELECT * FROM java.lang.String s where toString(s) = "execute"

SELECT * FROM java.lang.String s where s.@retainedHeapSize >1000

SELECT * FROM int[] a where a.@length > 10

select * from java.lang.Thread 
SELECT * FROM INSTANCEOF java.lang.Thread a WHERE toString(a.name) = "main"
SELECT * FROM  java.lang.Thread a WHERE toString(a.name) = "main"

SELECT * FROM java.lang.Thread a WHERE (toString(a.name) like "ma.*")

注意 和 like 和 sql的区别


SELECT * FROM OBJECTS java.lang.String
java.lang.String对应的Class

属性访问器

alias.field.field 
对象字段

alias@attribute 
属性

objectId	快照中对象的ID
objectAddress	快照中对象的地址
usedHeapSize	对象的shallowSize
retainedHeapSize	对象的retainedSize
displayName	对象的显示名称



length	数组的长度

SELECT a.@objectId,a.@objectAddress,a.@usedHeapSize,a.@retainedHeapSize,a.@displayName,a.@class,a.@clazz FROM java.lang.String a 
SELECT toString(a.value) FROM java.lang.String a

SELECT * FROM instanceof java.util.List 
无结果


SELECT * FROM  java.util.ArrayList 

SELECT * FROM instanceof java.util.ArrayList 

SELECT * FROM  "java.util.*List" 

SELECT * FROM instanceof "java.util.*List" 

SELECT * FROM  byte[]

SELECT * FROM  byte[] a where a.@length > 100000

SELECT s FROM java.lang.String s WHERE s.value.@length >= 10000

SELECT * FROM 0x2b7468c8,0x2b74aee0

SELECT * FROM 20815,20975

上一篇     下一篇
内存分析工具MAT中的重要概念

获取jvm heap dump 的几种方式

MAT内存泄露分析实战

java.lang.ref包

http2.0简介

ps aux -aux -ef之间的区别