GC.RemoveMemoryPressure : GC « System « C# / C Sharp by API






GC.RemoveMemoryPressure

  
using System;
using System.IO;
using System.Reflection;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;

public class MainClass
{
    public static void Main()
    {
        IntPtr ptr = Marshal.AllocHGlobal(1024);
        GC.AddMemoryPressure(1024);
        if (ptr != IntPtr.Zero) {
            Marshal.FreeHGlobal(ptr);
            ptr = IntPtr.Zero;
            GC.RemoveMemoryPressure(1024);
        }
    }
}

   
    
  








Related examples in the same category

1.GC.AddMemoryPressure
2.GC.GetGeneration
3.GC.GetTotalMemory
4.GC.MaxGeneration