--- old/src/hotspot/share/memory/metaspace.cpp 2018-03-07 11:03:33.636025132 -0800 +++ new/src/hotspot/share/memory/metaspace.cpp 2018-03-07 11:03:33.390001945 -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.