diff -r 17826b492ddd -r 9e29d8388514 src/hotspot/share/memory/metaspace.cpp --- a/src/hotspot/share/memory/metaspace.cpp Fri Oct 26 11:11:13 2018 +0800 +++ b/src/hotspot/share/memory/metaspace.cpp Thu Oct 25 21:40:17 2018 -0700 @@ -1291,10 +1291,9 @@ if (DumpSharedSpaces) { // CDS dumping keeps loading classes, so if we hit an OOM we probably will keep hitting OOM. // We should abort to avoid generating a potentially bad archive. - tty->print_cr("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", - MetaspaceObj::type_name(type), word_size * BytesPerWord); - tty->print_cr("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize); - vm_exit(1); + vm_exit_during_cds_dumping(err_msg("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", + MetaspaceObj::type_name(type), word_size * BytesPerWord), + err_msg("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize)); } report_metadata_oome(loader_data, word_size, type, mdtype, THREAD); assert(HAS_PENDING_EXCEPTION, "sanity");