--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp Mon Jul 01 08:24:45 2019 -0400
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp Mon Jul 01 18:24:06 2019 +0000
@@ -372,6 +372,8 @@
)
}
_dictionary->set_par_lock(&_parDictionaryAllocLock);
+
+ _used_stable = 0;
}
// Like CompactibleSpace forward() but always calls cross_threshold() to
@@ -577,6 +579,14 @@
return capacity() - free();
}
+size_t CompactibleFreeListSpace::used_stable() const {
+ return _used_stable;
+}
+
+void CompactibleFreeListSpace::recalculate_used_stable() {
+ _used_stable = used();
+}
+
size_t CompactibleFreeListSpace::free() const {
// "MT-safe, but not MT-precise"(TM), if you will: i.e.
// if you do this while the structures are in flux you
@@ -1374,6 +1384,9 @@
debug_only(fc->mangleAllocated(size));
}
+ // After allocation, recalculate used space and update used_stable
+ recalculate_used_stable();
+
return res;
}