Provide a stage that can dump the heap

Description

It can be hard to figure out where the memory is hiding in an MDA configuration. You can use -XX:+HeapDumpOnOutOfMemoryError to get a heap dump when things go entirely off piste, but the point where that happens is pretty unpredictable; an earlier point in time might be more interesting.

Another option would be to introduce a stage that causes a heap dump to a given location when executed.

  • This might have to be HotSpot-specific, but then -XX:+HeapDumpOnOutOfMemoryError is specific to certain VMs too.

  • It should probably optionally garbage collect before dumping (or optionally only dump live objects)

  • It should probably have an option to delete the dump file, as apparently they can't be overwritten.

One way to do this is described here: https://www.baeldung.com/java-heap-dump-capture

This looks like it is still part of Java 11:

https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/HotSpotDiagnosticMXBean.html

Environment

None

Activity

Details

Assignee

Reporter

Components

Affects versions

Created July 17, 2020 at 11:01 AM
Updated July 17, 2020 at 11:01 AM