--- 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);