changeset 47982:c7b50c23ea71

8190283: Default heap sizing options select a MaxHeapSize larger than available physical memory in some cases Reviewed-by: tschatzl, sjohanss
author bobv
date Tue, 07 Nov 2017 10:30:53 -0500
parents df4f4688b13d
children 18dccdc438d7
files src/hotspot/share/runtime/arguments.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/runtime/arguments.cpp	Tue Nov 07 13:51:18 2017 +0100
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Nov 07 10:30:53 2017 -0500
@@ -2089,9 +2089,10 @@
   // respecting the maximum and minimum sizes of the heap.
   if (FLAG_IS_DEFAULT(MaxHeapSize)) {
     julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
-    if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {
+    const julong reasonable_min = (julong)((phys_mem * MinRAMPercentage) / 100);
+    if (reasonable_min < MaxHeapSize) {
       // Small physical memory, so use a minimum fraction of it for the heap
-      reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
+      reasonable_max = reasonable_min;
     } else {
       // Not-small physical memory, so require a heap at least
       // as large as MaxHeapSize