# HG changeset patch # User pliden # Date 1552906239 -3600 # Node ID b9f030844be4b9eeb1f9f36b5bf5afe628fe2849 # Parent 84295bd6d35979d8450ec2002b8e4cc66a49020f 8220591: ZGC: Don't delay reclaimation of ZVirtualMemory Reviewed-by: stefank, eosterlund diff -r 84295bd6d359 -r b9f030844be4 src/hotspot/share/gc/z/zPageAllocator.cpp --- a/src/hotspot/share/gc/z/zPageAllocator.cpp Mon Mar 18 11:50:39 2019 +0100 +++ b/src/hotspot/share/gc/z/zPageAllocator.cpp Mon Mar 18 11:50:39 2019 +0100 @@ -253,12 +253,6 @@ void ZPageAllocator::destroy_page(ZPage* page) { assert(page->is_detached(), "Invalid page state"); - // Free virtual memory - { - ZLocker locker(&_lock); - _virtual.free(page->virtual_memory()); - } - delete page; } @@ -453,6 +447,9 @@ void ZPageAllocator::detach_memory(const ZVirtualMemory& vmem, ZPhysicalMemory& pmem) { const uintptr_t addr = vmem.start(); + // Free virtual memory + _virtual.free(vmem); + // Unmap physical memory _physical.unmap(pmem, addr);