< prev index next >

src/hotspot/share/gc/z/zDirector.cpp

Print this page

        

@@ -184,11 +184,11 @@
   // the heap reserve is not available to Java threads and is therefore not
   // considered part of the free memory.
   const size_t soft_max_capacity = ZHeap::heap()->soft_max_capacity();
   const size_t max_reserve = ZHeap::heap()->max_reserve();
   const size_t used = ZHeap::heap()->used();
-  const size_t free_with_reserve = soft_max_capacity - used;
+  const size_t free_with_reserve = soft_max_capacity - MIN2(soft_max_capacity, used);
   const size_t free = free_with_reserve - MIN2(free_with_reserve, max_reserve);
   const double free_percent = percent_of(free, soft_max_capacity);
 
   log_debug(gc, director)("Rule: High Usage, Free: " SIZE_FORMAT "MB(%.1f%%)",
                           free / M, free_percent);
< prev index next >