--- old/src/hotspot/share/memory/metaspace.cpp 2018-03-08 10:24:37.888547586 -0800 +++ new/src/hotspot/share/memory/metaspace.cpp 2018-03-08 10:24:37.621522413 -0800 @@ -3945,6 +3945,12 @@ MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype); if (result == NULL) { + if (DumpSharedSpaces && THREAD->is_VM_thread()) { + tty->print_cr("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", + MetaspaceObj::type_name(type), word_size * BytesPerWord); + vm_exit(1); + } + tracer()->report_metaspace_allocation_failure(loader_data, word_size, type, mdtype); // Allocation failed.