diff options
Diffstat (limited to 'src/mscorlib/src/System/Runtime/MemoryFailPoint.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/MemoryFailPoint.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs b/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs index 6e35568310..bd87d9027c 100644 --- a/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs +++ b/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs @@ -22,6 +22,7 @@ using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Security.Permissions; using System.Runtime.Versioning; +using System.Diagnostics; using System.Diagnostics.Contracts; /* @@ -143,7 +144,6 @@ namespace System.Runtime private ulong _reservedMemory; // The size of this request (from user) private bool _mustSubtractReservation; // Did we add data to SharedStatics? - [System.Security.SecuritySafeCritical] // auto-generated static MemoryFailPoint() { GetMemorySettings(out GCSegmentSize, out TopOfMemory); @@ -153,13 +153,13 @@ namespace System.Runtime // have scenarios for this in partial trust in the future, but // we're doing this just to restrict this in case the code below // is somehow incorrect. - [System.Security.SecurityCritical] // auto-generated_required public MemoryFailPoint(int sizeInMegabytes) { if (sizeInMegabytes <= 0) - throw new ArgumentOutOfRangeException("sizeInMegabytes", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + throw new ArgumentOutOfRangeException(nameof(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; @@ -283,7 +283,7 @@ namespace System.Runtime break; default: - Contract.Assert(false, "Fell through switch statement!"); + Debug.Assert(false, "Fell through switch statement!"); break; } } @@ -302,9 +302,9 @@ namespace System.Runtime SharedStatics.AddMemoryFailPointReservation((long) size); _mustSubtractReservation = true; } +#endif } - [System.Security.SecurityCritical] // auto-generated private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { bool r; @@ -321,7 +321,6 @@ namespace System.Runtime // returns whether there is enough space. In all cases, we update // our last known free address space, hopefully avoiding needing to // probe again. - [System.Security.SecurityCritical] // auto-generated private static unsafe bool CheckForFreeAddressSpace(ulong size, bool shouldThrow) { // Start walking the address space at 0. VirtualAlloc may wrap @@ -348,7 +347,6 @@ namespace System.Runtime // of pages. If we didn't have enough address space, we still return // a positive value < size, to help potentially avoid the overhead of // this check if we use a MemoryFailPoint with a smaller size next. - [System.Security.SecurityCritical] // auto-generated private static unsafe ulong MemFreeAfterAddress(void * address, ulong size) { if (size >= TopOfMemory) @@ -375,11 +373,9 @@ namespace System.Runtime return largestFreeRegion; } - [System.Security.SecurityCritical] // auto-generated [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetMemorySettings(out ulong maxGCSegmentSize, out ulong topOfMemory); - [System.Security.SecuritySafeCritical] // destructors should be safe to call ~MemoryFailPoint() { Dispose(false); @@ -392,14 +388,12 @@ namespace System.Runtime // future create an allocation context and release it in the Dispose // method. While the finalizer will eventually free this block of // memory, apps will help their performance greatly by calling Dispose. - [System.Security.SecuritySafeCritical] // auto-generated public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } - [System.Security.SecurityCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private void Dispose(bool disposing) { |