Skip to content

Commit

Permalink
8334357: Use NonInterleavingLogStream for report_metadata_oome
Browse files Browse the repository at this point in the history
Reviewed-by: jsjolen, stuefe
  • Loading branch information
xmas92 committed Aug 22, 2024
1 parent 47c8a6a commit 1d05989
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/hotspot/share/memory/metaspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1d05989

Please sign in to comment.