--- old/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp 2018-10-29 23:13:09.558228362 -0400 +++ new/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp 2018-10-29 23:13:09.342228351 -0400 @@ -89,7 +89,6 @@ // nodes with a 0 container_count. Remove Metachunks in // the node from their respective freelists. void VirtualSpaceList::purge(ChunkManager* chunk_manager) { - assert(SafepointSynchronize::is_at_safepoint(), "must be called at safepoint for contains to work"); assert_lock_strong(MetaspaceExpand_lock); // Don't use a VirtualSpaceListIterator because this // list is being changed and a straightforward use of an iterator is not safe. @@ -142,6 +141,8 @@ // The chunks are added with store ordering and not deleted except for at // unloading time during a safepoint. VirtualSpaceNode* VirtualSpaceList::find_enclosing_space(const void* ptr) { + MutexLockerEx cl(MetaspaceExpand_lock, + Mutex::_no_safepoint_check_flag); // List should be stable enough to use an iterator here because removing virtual // space nodes is only allowed at a safepoint. VirtualSpaceListIterator iter(virtual_space_list());