8255990: Bitmap region of dynamic CDS archive is not unmapped

Reviewed-by: iklam, minqi
This commit is contained in:
Calvin Cheung 2020-11-12 16:14:29 +00:00
parent 943acd22e5
commit c6ab0fdb15
2 changed files with 9 additions and 1 deletions

View File

@ -1748,6 +1748,7 @@ void MetaspaceShared::initialize_shared_spaces() {
SymbolTable::serialize_shared_table_header(&rc, false);
SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
dynamic_mapinfo->close();
dynamic_mapinfo->unmap_region(MetaspaceShared::bm);
}
if (PrintSharedArchiveAndExit) {

View File

@ -91,6 +91,8 @@ public class DynamicArchiveRelocationTest extends DynamicArchiveTestBase {
String topArchiveName = getNewArchiveName("top");
String runtimeMsg = "Try to map archive(s) at an alternative address";
String unmapPrefix = ".*Unmapping region #3 at base 0x.*";
String unmapPattern = unmapPrefix + "(Bitmap)";
String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
// (1) Dump base archive (static)
@ -121,7 +123,12 @@ public class DynamicArchiveRelocationTest extends DynamicArchiveTestBase {
"-cp", appJar, mainClass)
.assertNormalExit(output -> {
if (run_reloc) {
output.shouldContain(runtimeMsg);
output.shouldContain(runtimeMsg)
// Check that there are two of the following lines in
// the output. One for static archive and one for
// dynamic archive:
// Unmapping region #3 at base 0x<hex digits> (Bitmap)
.shouldMatchByLine(unmapPrefix, "Hello World", unmapPattern);
}
});
}