开发者

get static fields of a class in a heap dump in OQL

开发者 https://www.devze.com 2023-01-20 18:52 出处:网络
I have a heap dump and I\'m using Eclipse MAT, though I suppose this should work through visualvm or whatever OQL client.

I have a heap dump and I'm using Eclipse MAT, though I suppose this should work through visualvm or whatever OQL client.

We can select fields of all instances of a class by doing something like

select s.field1, s.field2 from o开发者_运维百科rg.me.MyClass

... but this is restricted to member variables, and to types with instances.

How can select the static fields of a class with no instances?

This is somewhat related to this other question.


This is a bit hackish, but works in MAT:

SELECT c.SIZE
FROM INSTANCEOF java.lang.Class c
WHERE c.@displayName.contains("class java.lang.Integer ")


To access static field 'props' of class java.lang.System you can use (in VisualVM)

select heap.findClass("java.lang.System").statics.props
select heap.findClass("java.lang.System").props
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号