/// <summary>Informs the runtime that unmanaged memory has been released and no longer needs to be taken into account when scheduling garbage collection.</summary> /// <param name="bytesAllocated">The amount of unmanaged memory that has been released. </param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="bytesAllocated" /> is less than or equal to 0. -or- On a 32-bit computer, <paramref name="bytesAllocated" /> is larger than <see cref="F:System.Int32.MaxValue" />. </exception> /// <filterpriority>1</filterpriority> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /> /// </PermissionSet> public static void RemoveMemoryPressure(long bytesAllocated) { GC.RecordPressure(-bytesAllocated); }
/// <summary>Informs the runtime of a large allocation of unmanaged memory that should be taken into account when scheduling garbage collection.</summary> /// <param name="bytesAllocated">The incremental amount of unmanaged memory that has been allocated. </param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="bytesAllocated" /> is less than or equal to 0.-or-On a 32-bit computer, <paramref name="bytesAllocated" /> is larger than <see cref="F:System.Int32.MaxValue" />. </exception> /// <filterpriority>1</filterpriority> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /> /// </PermissionSet> public static void AddMemoryPressure(long bytesAllocated) { GC.RecordPressure(bytesAllocated); }