Skip to content

Commit c6ab0fd

Browse files
committed
8255990: Bitmap region of dynamic CDS archive is not unmapped
Reviewed-by: iklam, minqi
1 parent 943acd2 commit c6ab0fd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/hotspot/share/memory/metaspaceShared.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,7 @@ void MetaspaceShared::initialize_shared_spaces() {
17481748
SymbolTable::serialize_shared_table_header(&rc, false);
17491749
SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
17501750
dynamic_mapinfo->close();
1751+
dynamic_mapinfo->unmap_region(MetaspaceShared::bm);
17511752
}
17521753

17531754
if (PrintSharedArchiveAndExit) {

test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static void doTest() throws Exception {
9191
String topArchiveName = getNewArchiveName("top");
9292

9393
String runtimeMsg = "Try to map archive(s) at an alternative address";
94+
String unmapPrefix = ".*Unmapping region #3 at base 0x.*";
95+
String unmapPattern = unmapPrefix + "(Bitmap)";
9496
String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
9597

9698
// (1) Dump base archive (static)
@@ -121,7 +123,12 @@ static void doTest() throws Exception {
121123
"-cp", appJar, mainClass)
122124
.assertNormalExit(output -> {
123125
if (run_reloc) {
124-
output.shouldContain(runtimeMsg);
126+
output.shouldContain(runtimeMsg)
127+
// Check that there are two of the following lines in
128+
// the output. One for static archive and one for
129+
// dynamic archive:
130+
// Unmapping region #3 at base 0x<hex digits> (Bitmap)
131+
.shouldMatchByLine(unmapPrefix, "Hello World", unmapPattern);
125132
}
126133
});
127134
}

0 commit comments

Comments
 (0)