Fix issue with statistics which caused Metaspace::used_words() to be too high stuefe-new-metaspace-branch
authorstuefe
Mon, 07 Oct 2019 15:48:26 +0200
branchstuefe-new-metaspace-branch
changeset 58475 e3aa9f95b85e
parent 58383 04d2c850ab4f
child 58494 54c1ba464b78
Fix issue with statistics which caused Metaspace::used_words() to be too high
src/hotspot/share/memory/metaspace/spaceManager.cpp
--- a/src/hotspot/share/memory/metaspace/spaceManager.cpp	Fri Sep 27 19:03:34 2019 +0200
+++ b/src/hotspot/share/memory/metaspace/spaceManager.cpp	Mon Oct 07 15:48:26 2019 +0200
@@ -253,6 +253,10 @@
     if (p != NULL) {
       DEBUG_ONLY(InternalStats::inc_num_allocs_from_deallocated_blocks();)
       log_trace(metaspace)("SpaceManager %s: .. taken from freelist.", _name);
+      // Note: space in the freeblock dictionary counts as used (see retire_current_chunk()) -
+      // that means that we must not increase the used counter again when allocating from the dictionary.
+      // Therefore we return here.
+      return p;
     }
 
   }