Disabling checks in MemoryFailPoint for Xplat till primitives like VirtualQuery
authorDDCloud <ramarag@microsoft.com>
Wed, 2 Nov 2016 00:48:23 +0000 (17:48 -0700)
committerDDCloud <ramarag@microsoft.com>
Wed, 2 Nov 2016 00:48:23 +0000 (17:48 -0700)
are implmemented properly

Commit migrated from https://github.com/dotnet/coreclr/commit/953361eb2d4092feaf509dfc5b23edcc0146efda

src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs

index 4ae6047..1f0ea8c 100644 (file)
@@ -160,6 +160,7 @@ namespace System.Runtime
                 throw new ArgumentOutOfRangeException("sizeInMegabytes", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             Contract.EndContractBlock();
 
+#if !FEATURE_PAL // Remove this when CheckForAvailableMemory is able to provide legitimate estimates
             ulong size = ((ulong)sizeInMegabytes) << 20;
             _reservedMemory = size;
 
@@ -302,6 +303,7 @@ namespace System.Runtime
                 SharedStatics.AddMemoryFailPointReservation((long) size);
                 _mustSubtractReservation = true;
             }
+#endif
         }
 
         [System.Security.SecurityCritical]  // auto-generated
@@ -324,9 +326,6 @@ namespace System.Runtime
         [System.Security.SecurityCritical]  // auto-generated
         private static unsafe bool CheckForFreeAddressSpace(ulong size, bool shouldThrow)
         {
-#if FEATURE_PAL // Remove this when GlobalMemoryStatusEx is able to provide legitimate estimates
-            return true;
-#endif
             // Start walking the address space at 0.  VirtualAlloc may wrap
             // around the address space.  We don't need to find the exact
             // pages that VirtualAlloc would return - we just need to