With Oracle's Hotspot JVM, it looks like jmap -dump:file=/tmp/dump.txt <pid>
can be used to take a heap dump.
However, Eclipse OpenJ9 doesn't include the jmap
tool - and if you try to use the regular jmap
with OpenJ9's jvm, it gives the exception:
Exception in thread "main" java.lang.ClassCastException: com.ibm.tools.attach.attacher.OpenJ9VirtualMachine incompatible with sun.tools.attach.HotSpotVirtualMachine
at java.lang.ClassCastException.<init>([email protected]/ClassCastException.java:71)
at sun.tools.jmap.JMap.executeCommandForPid([email protected]/JMap.java:128)
at sun.tools.jmap.JMap.dump([email protected]/JMap.java:192)
at sun.tools.jmap.JMap.main([email protected]/JMap.java:110)
So, how can one take a heap dump with OpenJ9?