@@ -893,20 +893,22 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
893893 tracer ()->report_metadata_oom (loader_data, word_size, type, mdtype);
894894
895895 // If result is still null, we are out of memory.
896- Log (gc, metaspace, freelist, oom) log;
897- if (log.is_info ()) {
898- log.info (" Metaspace (%s) allocation failed for size " SIZE_FORMAT,
899- is_class_space_allocation (mdtype) ? " class" : " data" , word_size);
900- ResourceMark rm;
901- if (log.is_debug ()) {
902- if (loader_data->metaspace_or_null () != nullptr ) {
903- LogStream ls (log.debug ());
904- loader_data->print_value_on (&ls);
896+ {
897+ LogMessage (gc, metaspace, freelist, oom) log;
898+ if (log.is_info ()) {
899+ log.info (" Metaspace (%s) allocation failed for size " SIZE_FORMAT,
900+ is_class_space_allocation (mdtype) ? " class" : " data" , word_size);
901+ ResourceMark rm;
902+ if (log.is_debug ()) {
903+ if (loader_data->metaspace_or_null () != nullptr ) {
904+ NonInterleavingLogStream ls (LogLevelType::Debug, log);
905+ loader_data->print_value_on (&ls);
906+ }
905907 }
908+ NonInterleavingLogStream ls (LogLevelType::Info, log);
909+ // In case of an OOM, log out a short but still useful report.
910+ MetaspaceUtils::print_basic_report (&ls, 0 );
906911 }
907- LogStream ls (log.info ());
908- // In case of an OOM, log out a short but still useful report.
909- MetaspaceUtils::print_basic_report (&ls, 0 );
910912 }
911913
912914 bool out_of_compressed_class_space = false ;
0 commit comments