Optimize reset_memory to only kick in for low memory situations. (#37894)
authorPeter Sollich <petersol@microsoft.com>
Thu, 18 Jun 2020 12:29:19 +0000 (14:29 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Jun 2020 12:29:19 +0000 (14:29 +0200)
This will save time both in VirtualReset and later in page faults.

src/coreclr/src/gc/gc.cpp

index c7f0489..849776e 100644 (file)
@@ -32577,7 +32577,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)
+        if (reset_mm_p && gc_heap::g_low_memory_status)
         {
 #ifdef MULTIPLE_HEAPS
             bool unlock_p = true;