diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index d21534990b7ec5..8edf652f2a9b92 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -25628,8 +25628,6 @@ void gc_heap::check_heap_count () // background GC is running - reset the new heap count dynamic_heap_count_data.new_n_heaps = n_heaps; dprintf (6666, ("can't change heap count! BGC in progress")); - - GCToEEInterface::RestartEE(TRUE); } #endif //BACKGROUND_GC } @@ -25653,6 +25651,8 @@ void gc_heap::check_heap_count () dprintf (6666, ("heap count stays the same %d, no work to do, set processed sample count to %Id", dynamic_heap_count_data.new_n_heaps, dynamic_heap_count_data.current_samples_count)); + GCToEEInterface::RestartEE(TRUE); + return; }