# HG changeset patch # User stuefe # Date 1574190065 -3600 # Node ID 714474295e0a1e327b05de38b2da7de7bc34c984 # Parent 84464aa83a295fadac8e42bd8a2b739516aea086 Honor AlwaysPreTouch when commiting memory diff -r 84464aa83a29 -r 714474295e0a src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp Tue Nov 19 16:58:25 2019 +0100 +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp Tue Nov 19 20:01:05 2019 +0100 @@ -40,6 +40,7 @@ #include "memory/metaspace/runningCounters.hpp" #include "memory/metaspace/virtualSpaceNode.hpp" +#include "runtime/globals.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" @@ -62,6 +63,7 @@ } #endif + // Given an address range, ensure it is committed. // // The range has to be aligned to granule size. @@ -108,6 +110,10 @@ vm_exit_out_of_memory(word_size * BytesPerWord, OOM_MMAP_ERROR, "Failed to commit metaspace."); } + if (AlwaysPreTouch) { + os::pretouch_memory(p, p + word_size); + } + log_debug(gc, metaspace)("Increased metaspace by " SIZE_FORMAT " bytes.", commit_increase_words * BytesPerWord);