Search code examples
javawebsphereheap-memorydumpopenj9

How to create a compatible heap dump with OpenJ9 via API?


I try to create a heap dump with a OpenJ9 Java VM via API that is compatible with a heap dump from a Hotspot Java VM and can be use with the same analyzer tools.

I use the follow code:

Class<PlatformManagedObject> clazz = (Class)Class.forName( "openj9.lang.management.OpenJ9DiagnosticsMXBean", null );
PlatformManagedObject openj9MBean = ManagementFactory.newPlatformMXBeanProxy( server, "openj9.lang.management:type=OpenJ9Diagnostics", clazz );
Method triggerDumpToFile = clazz.getMethod( "triggerDumpToFile", String.class, String.class );
triggerDumpToFile.invoke( openj9MBean, dumpAgent, file.getAbsolutePath() );

I try all 4 values for dumpAgent (java, snap, system and heap) but the output format is not in the *.hprof file format.

Are there other options?


Solution

  • If you use the dumpAgent heap then it create a *.phd file (portable heap dump). If you want analyze it with Eclipse MAT then you need to install the IBM Monitoring and Diagnostic Tools plugin.

    The update site ist: http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/runtimes/tools/dtfj/

    For Details: https://www.artificialworlds.net/blog/2016/02/23/how-to-analyse-a-phd-heap-dump-from-an-ibm-jvm/