From 1d05989bb4bcc08ef6f7c408ec987ea43995eb07 Mon Sep 17 00:00:00 2001 From: Axel Boldt-Christmas Date: Thu, 22 Aug 2024 06:23:06 +0000 Subject: [PATCH] 8334357: Use NonInterleavingLogStream for report_metadata_oome Reviewed-by: jsjolen, stuefe --- src/hotspot/share/memory/metaspace.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index 7e01b42a87357..ad51f5ab7b6db 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -893,20 +893,22 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s tracer()->report_metadata_oom(loader_data, word_size, type, mdtype); // If result is still null, we are out of memory. - Log(gc, metaspace, freelist, oom) log; - if (log.is_info()) { - log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT, - is_class_space_allocation(mdtype) ? "class" : "data", word_size); - ResourceMark rm; - if (log.is_debug()) { - if (loader_data->metaspace_or_null() != nullptr) { - LogStream ls(log.debug()); - loader_data->print_value_on(&ls); + { + LogMessage(gc, metaspace, freelist, oom) log; + if (log.is_info()) { + log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT, + is_class_space_allocation(mdtype) ? "class" : "data", word_size); + ResourceMark rm; + if (log.is_debug()) { + if (loader_data->metaspace_or_null() != nullptr) { + NonInterleavingLogStream ls(LogLevelType::Debug, log); + loader_data->print_value_on(&ls); + } } + NonInterleavingLogStream ls(LogLevelType::Info, log); + // In case of an OOM, log out a short but still useful report. + MetaspaceUtils::print_basic_report(&ls, 0); } - LogStream ls(log.info()); - // In case of an OOM, log out a short but still useful report. - MetaspaceUtils::print_basic_report(&ls, 0); } bool out_of_compressed_class_space = false;