--- old/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp Fri Jun 21 17:34:04 2019 +++ new/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp Fri Jun 21 17:34:03 2019 @@ -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; }