src/share/vm/services/management.cpp

Print this page

        

@@ -874,12 +874,10 @@
     if ((heap && pool->is_heap()) || (!heap && pool->is_non_heap())) {
       MemoryUsage u = pool->get_memory_usage();
       total_used += u.used();
       total_committed += u.committed();
 
-      // if any one of the memory pool has undefined init_size or max_size,
-      // set it to -1
       if (u.init_size() == (size_t)-1) {
         has_undefined_init_size = true;
       }
       if (!has_undefined_init_size) {
         total_init += u.init_size();

@@ -892,10 +890,19 @@
         total_max += u.max_size();
       }
     }
   }
 
+  // if any one of the memory pool has undefined init_size or max_size,
+  // set it to -1
+  if (has_undefined_init_size) {
+    total_init = (size_t)-1;
+  }
+  if (has_undefined_max_size) {
+    total_max = (size_t)-1;
+  }
+
   MemoryUsage usage((heap ? InitialHeapSize : total_init),
                     total_used,
                     total_committed,
                     (heap ? Universe::heap()->max_capacity() : total_max));