This page seems to imply that you can combine -XX:+HeapDumpOnOutOfMemoryErrorand-XX:OnOutOfMemoryError="kill -9 %p"
Presumably, a heap dump is created before running the "On ..." command. (It should be easy to put together something to test it.)
source
share