--- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java 2018-11-21 22:00:13.876000000 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java 2018-11-21 22:00:13.580000000 +0530 @@ -32,6 +32,7 @@ import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.classfile.*; +import sun.jvm.hotspot.gc.z.ZCollectedHeap; /* * This class writes Java heap in hprof binary format. This format is @@ -393,6 +394,10 @@ out = new DataOutputStream(new BufferedOutputStream(fos)); VM vm = VM.getVM(); + if (vm.getUniverse().heap() instanceof ZCollectedHeap) { + throw new RuntimeException("This operation is not supported with ZGC."); + } + dbg = vm.getDebugger(); objectHeap = vm.getObjectHeap();