Projects
Mega:24.03:SP1:Everything
openjdk-1.8.0
_service:tar_scm:Add-metaspace-memory-allocatio...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:Add-metaspace-memory-allocation-failure-validation.patch of Package openjdk-1.8.0
From 0778f0119083ae33aea5ce9b5a1b44f565f45397 Mon Sep 17 00:00:00 2001 Date: Thu, 19 Oct 2023 15:25:43 +0800 Subject: [PATCH 4/5] Add metaspace memory allocation failure validation --- hotspot/src/share/vm/memory/metaspace.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 0569500c1..f39ae41f3 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -571,7 +571,7 @@ class OccupancyMap : public CHeapObj<mtInternal> { assert(_map_size * 8 >= num_bits, "sanity"); _map[0] = (uint8_t*) os::malloc(_map_size, mtInternal); _map[1] = (uint8_t*) os::malloc(_map_size, mtInternal); - assert(_map[0] != NULL && _map[1] != NULL, "Occupancy Map: allocation failed."); + guarantee(_map[0] != NULL && _map[1] != NULL, "Metaspace Occupancy Map: allocation failed."); memset(_map[1], 0, _map_size); memset(_map[0], 0, _map_size); // Sanity test: the first respectively last possible chunk start address in @@ -918,6 +918,14 @@ void VirtualSpaceNode::print_map(outputStream* st, bool is_class) const { char* lines[NUM_LINES]; for (int i = 0; i < NUM_LINES; i ++) { lines[i] = (char*)os::malloc(line_len, mtInternal); + // Only print the VirtualSpaceNode memory layout during metaspace OOM. + // If it fails,we should return instead of hanging the VM. + if (lines[i] == NULL) { + for (int j = 0; j < i; j ++) { + os::free(lines[j]); + } + return; + } } int pos = 0; const MetaWord* p = bottom(); -- 2.19.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2