读取堆转储中的 HashMap 对象内容

huangapple go评论62阅读模式
英文:

JAVA: Read HashMap object Content from Heapdump

问题

我需要更深入地分析一个内存溢出(OOM),并且需要找出在 Oracle 的 T4CPreparedStatement JDBC 层内导致内存溢出的对象是哪些。因此,我正在寻找 java.util.Hashtable$Entry[] 内部的内容。

  • 从 HeapDump 中是否可以实现这一点?
  • 通过 JMX 连接是否可以实现这一点?

我的堆转储(*.phd 文件)是由 WebSphere 应用服务器在内存溢出期间自动创建的。

附注:可能可以在 Eclipse Memory Analyzer 工具中通过 IBM 扩展来完成,但具体如何操作呢?

英文:

i need to analyze an OOM more deeper and need to find out, which objects cause the OOM inside of the T4CPreparedStatement JDBC Layer from oracle. So therefore i am looking for the content inside the HashMap (java.util.Hashtable$Entry[]).

  • Is this possible from the HeapDump?
  • Is this possible via JMX connection?

My HeapDump (*.phd files) was created by Websphere Application Server automatically during OOM.

PS: probably it can be done in the Eclipse Memory Analyzer Tool with the IBM Extensions but how?

答案1

得分: 1

PHD文件中不包含原始字段值或原始数组内容,因此最多只能看到HashMap中键和值的类型。

哈希映射集合查询将失败,显示信息为:“转储格式'DTFJ-PHD'不支持检查'Hash Entries'。”

“按类显示对象”可能有助于查看所持有的各种内容:

    类名                                   | 对象数 | 浅堆大小
    ------------------------------------------------------------------
    java.util.HashMap                        |       1 |           40
    |- java.lang.Class                       |       1 |          160
    |- java.util.HashMap$Node[]              |       1 |          136
    |  |- java.util.HashMap$Node             |      10 |          240
    |  |  |- sun.misc.URLClassPath$JarLoader |       9 |          504
    |  |  |- java.lang.Class                 |       1 |          160
    |  |  |- java.lang.String                |      10 |          160
    |  |  |- java.util.HashMap$Node          |       4 |           96
    |  |  |- sun.misc.URLClassPath$FileLoader|       1 |           24
    |  |  '- 总计:5个条目                       |         |             
    ------------------------------------------------------------------

实际上,您需要进行系统转储。

英文:

PHD files do not have primitive field values or primitive array contents so at best you could see the types of keys and values in a HashMap.

The hash map collection query will fail with: "Dump format 'DTFJ-PHD' does not support inspection 'Hash Entries'."

'Show objects by class' might help to see what sorts of things are held:

<pre>
Class Name | Objects | Shallow Heap
------------------------------------------------------------------
java.util.HashMap | 1 | 40
|- java.lang.Class | 1 | 160
|- java.util.HashMap$Node[] | 1 | 136
| |- java.util.HashMap$Node | 10 | 240
| | |- sun.misc.URLClassPath$JarLoader | 9 | 504
| | |- java.lang.Class | 1 | 160
| | |- java.lang.String | 10 | 160
| | |- java.util.HashMap$Node | 4 | 96
| | |- sun.misc.URLClassPath$FileLoader| 1 | 24
| | '- Total: 5 entries | |
------------------------------------------------------------------
</pre>
Really you need a system dump.

huangapple
  • 本文由 发表于 2020年10月1日 20:51:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/64155796.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定