Fix trim_youngest_desired for the case of high memory load and huge main memory ...
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thu, 2 Sep 2021 20:43:02 +0000 (13:43 -0700)
committerGitHub <noreply@github.com>
Thu, 2 Sep 2021 20:43:02 +0000 (13:43 -0700)
Co-authored-by: Peter Sollich <petersol@microsoft.com>
src/coreclr/gc/gc.cpp

index 934cfb0da730b23b71b46564c47333a5fcfe1a13..26233d54eba2ac6b23f3fd065face0285dc87a56 100644 (file)
@@ -38191,7 +38191,8 @@ size_t gc_heap::trim_youngest_desired (uint32_t memory_load,
     }
     else
     {
-        return max (mem_one_percent, total_min_allocation);
+        size_t total_max_allocation = max (mem_one_percent, total_min_allocation);
+        return min (total_new_allocation, total_max_allocation);
     }
 }