diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 934cfb0da730b2..bc91b5d2f341bb 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -3255,6 +3255,12 @@ gc_heap::dt_low_card_table_efficiency_p (gc_tuning_point tp) return ret; } +inline BOOL +gc_heap::dt_high_memory_load_p() +{ + return ((settings.entry_memory_load >= high_memory_load_th) || g_low_memory_status); +} + inline BOOL in_range_for_segment(uint8_t* add, heap_segment* seg) { @@ -10917,7 +10923,7 @@ void gc_heap::clear_region_info (heap_segment* region) settings.gc_index, current_bgc_state, seg_deleted); - if (settings.entry_memory_load >= high_memory_load_th || g_low_memory_status) + if (dt_high_memory_load_p()) { decommit_mark_array_by_seg (region); } @@ -11376,7 +11382,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg, uint8_t* new_committed) { #ifdef USE_REGIONS - if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status) + if (!dt_high_memory_load_p()) { return 0; } @@ -11411,7 +11417,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg, void gc_heap::decommit_heap_segment (heap_segment* seg) { #ifdef USE_REGIONS - if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status) + if (!dt_high_memory_load_p()) { return; } @@ -39354,7 +39360,7 @@ void reset_memory (uint8_t* o, size_t sizeo) size_t size = align_lower_page ((size_t)o + sizeo - size_to_skip - plug_skew) - page_start; // Note we need to compensate for an OS bug here. This bug would cause the MEM_RESET to fail // on write watched memory. - if (reset_mm_p && gc_heap::g_low_memory_status) + if (reset_mm_p && gc_heap::dt_high_memory_load_p()) { #ifdef MULTIPLE_HEAPS bool unlock_p = true; diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index cda8e68e0a08f8..ce14ce63412af7 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -4962,6 +4962,9 @@ class gc_heap PER_HEAP_ISOLATED size_t exponential_smoothing (int gen, size_t collection_count, size_t desired_per_heap); + PER_HEAP_ISOLATED + BOOL dt_high_memory_load_p(); + protected: PER_HEAP void update_collection_counts ();