diff a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp --- a/src/hotspot/share/memory/filemap.cpp +++ b/src/hotspot/share/memory/filemap.cpp @@ -243,10 +243,11 @@ _base_archive_name_size = 0; _base_archive_is_default = false; if (!DynamicDumpSharedSpaces) { set_shared_path_table(mapinfo->_shared_path_table); + CDS_JAVA_HEAP_ONLY(_heap_obj_roots = CompressedOops::encode(HeapShared::roots())); } } void SharedClassPathEntry::init_as_non_existent(const char* path, TRAPS) { _type = non_existent_entry; @@ -1828,10 +1829,11 @@ MetaspaceShared::first_open_archive_heap_region, MetaspaceShared::max_open_archive_heap_region, &num_open_archive_heap_ranges, true /* open */)) { HeapShared::set_open_archive_heap_region_mapped(); + HeapShared::set_roots(header()->heap_obj_roots()); } } } void FileMapInfo::map_heap_regions() {