diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index cb0ab8bc58b07c..2356cbc8761280 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -3263,6 +3263,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) { @@ -11115,7 +11121,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); } @@ -11574,7 +11580,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; } @@ -11609,7 +11615,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; } @@ -39539,7 +39545,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 9fe5dfbfb34410..24dd413a5726d7 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -4993,6 +4993,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 ();