Java Heap Dump以编程方式

时间:2016-11-03 10:27:07

标签: java heap-dump

我的情况是:

  • Java 1.3或1.8
  • Windows CE或Windows Mobile
  • PDA,而不是桌面
  • jmap.exe不可用

要以编程方式获取堆转储,我需要类com.ibm.jvm.Dump,但此类通常不可用,因此我收到ClassNotFoundException。

// Has to be run like this:
// cmd> javaPath -Xdump -Xmn5m -jar myJarPath
Class dump = Class.forName("com.ibm.jvm.Dump");
dump.getMethod("JavaDump", new Class[] {}).invoke(null, null);
dump.getMethod("HeapDump", new Class[] {}).invoke(null, null);
dump.getMethod("SystemDump", new Class[] {}).invoke(null, null);
// On some devices may occur ClassNotFoundException com.ibm.jvm.Dump
// or is missing j9dmp24 (but I don't understand this as all DLLs are in the device)
// do not forget to add parameter -Xdump when you are running your app. This parameter should probably be the 1st.
// I had error UTE437: Unable to load formatStrings for j9mm .. So I had to add parameter -Xmn5m
  • 有没有更多方法可以在所有不同的Javas中以编程方式创建堆转储? ...用户在菜单中单击并应创建转储。
  • 我可以编写自己的通用算法来获取堆转储吗?

1 个答案:

答案 0 :(得分:0)

确定。因此,本问题和评论中提到的2种方法似乎只适用于某些设备。如果其中一个有效,另一个则无效。你必须将它们结合起来才能发挥作用。

相关问题