1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue Dec 17 05:07:06 2019 +0000 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue Dec 17 05:26:57 2019 +0000 1.3 @@ -869,6 +869,10 @@ 1.4 return _cmsSpace->max_alloc_in_words() * HeapWordSize; 1.5 } 1.6 1.7 +size_t ConcurrentMarkSweepGeneration::used_stable() const { 1.8 + return cmsSpace()->used_stable(); 1.9 +} 1.10 + 1.11 size_t ConcurrentMarkSweepGeneration::max_available() const { 1.12 return free() + _virtual_space.uncommitted_size(); 1.13 } 1.14 @@ -1955,6 +1959,8 @@ 1.15 FreelistLocker z(this); 1.16 MetaspaceGC::compute_new_size(); 1.17 _cmsGen->compute_new_size_free_list(); 1.18 + // recalculate CMS used space after CMS collection 1.19 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.20 } 1.21 1.22 // A work method used by foreground collection to determine 1.23 @@ -2768,6 +2774,7 @@ 1.24 1.25 _capacity_at_prologue = capacity(); 1.26 _used_at_prologue = used(); 1.27 + _cmsSpace->recalculate_used_stable(); 1.28 1.29 // Delegate to CMScollector which knows how to coordinate between 1.30 // this and any other CMS generations that it is responsible for 1.31 @@ -2837,6 +2844,7 @@ 1.32 _eden_chunk_index = 0; 1.33 1.34 size_t cms_used = _cmsGen->cmsSpace()->used(); 1.35 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.36 1.37 // update performance counters - this uses a special version of 1.38 // update_counters() that allows the utilization to be passed as a 1.39 @@ -3672,6 +3680,7 @@ 1.40 _collectorState = Marking; 1.41 } 1.42 SpecializationStats::print(); 1.43 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.44 } 1.45 1.46 void CMSCollector::checkpointRootsInitialWork(bool asynch) { 1.47 @@ -5066,10 +5075,12 @@ 1.48 Mutex::_no_safepoint_check_flag); 1.49 assert(!init_mark_was_synchronous, "but that's impossible!"); 1.50 checkpointRootsFinalWork(asynch, clear_all_soft_refs, false); 1.51 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.52 } else { 1.53 // already have all the locks 1.54 checkpointRootsFinalWork(asynch, clear_all_soft_refs, 1.55 init_mark_was_synchronous); 1.56 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.57 } 1.58 verify_work_stacks_empty(); 1.59 verify_overflow_empty(); 1.60 @@ -6368,6 +6379,10 @@ 1.61 // Update heap occupancy information which is used as 1.62 // input to soft ref clearing policy at the next gc. 1.63 Universe::update_heap_info_at_gc(); 1.64 + 1.65 + // recalculate CMS used space after CMS collection 1.66 + _cmsGen->cmsSpace()->recalculate_used_stable(); 1.67 + 1.68 _collectorState = Resizing; 1.69 } 1.70 } else { 1.71 @@ -6467,6 +6482,7 @@ 1.72 // Gather statistics on the young generation collection. 1.73 collector()->stats().record_gc0_end(used()); 1.74 } 1.75 + _cmsSpace->recalculate_used_stable(); 1.76 } 1.77 1.78 CMSAdaptiveSizePolicy* ConcurrentMarkSweepGeneration::size_policy() {