SoFunction
Updated on 2025-04-06

C# memory recycling code

[DllImport("", EntryPoint = "SetProcessWorkingSetSize")]
public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
/// <summary>
/// Free memory
/// </summary>
public static void ClearMemory()
{
    ();
    ();
    if ( == PlatformID.Win32NT)
    {
 SetProcessWorkingSetSize(().Handle, -1, -1);
    }
}