diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 20583ce492ddd..1e6213fa909eb 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -227,6 +227,11 @@ void CodeCache::initialize_heaps() { if (!non_nmethod.set) { non_nmethod.size += compiler_buffer_size; + // Further down, just before FLAG_SET_ERGO(), all segment sizes are + // aligned down to the next lower multiple of min_size. For large page + // sizes, this may result in (non_nmethod.size == 0) which is not acceptable. + // Therefore, force non_nmethod.size to at least min_size. + non_nmethod.size = MAX2(non_nmethod.size, min_size); } if (!profiled.set && !non_profiled.set) {