# HG changeset patch # User aeriksso # Date 1446720162 -3600 # Node ID acb9351e3a29dd621935a1723993e44d5975f4b2 # Parent 1a1aec8c87b7902f59c3433a05e5c04793691b50 8134030: test/serviceability/dcmd/gc/HeapDumpTest fails to verify the dump Reviewed-by: dholmes diff -r 1a1aec8c87b7 -r acb9351e3a29 src/share/vm/services/heapDumper.cpp --- a/src/share/vm/services/heapDumper.cpp Fri Jan 18 17:05:41 2019 +0100 +++ b/src/share/vm/services/heapDumper.cpp Thu Nov 05 11:42:42 2015 +0100 @@ -941,8 +941,14 @@ // its array classes void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) { Klass* klass = k; - assert(klass->oop_is_instance(), "not an InstanceKlass"); - InstanceKlass* ik = (InstanceKlass*)klass; + InstanceKlass* ik = InstanceKlass::cast(k); + + // We can safepoint and do a heap dump at a point where we have a Klass, + // but no java mirror class has been setup for it. So we need to check + // that the class is at least loaded, to avoid crash from a null mirror. + if (!ik->is_loaded()) { + return; + } writer->write_u1(HPROF_GC_CLASS_DUMP);