Solutions are as follows:
- in class (cited in the class) definition [DllImport("KERNEL32.DLL", EntryPoint = "SetProcessWorkingSetSize", SetLastError = true, CallingConvention = CallingConvention.StdCall)] internal static extern bool SetProcessWorkingSetSize(IntPtr pProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize); [DllImport("KERNEL32.DLL", EntryPoint = "GetCurrentProcess", SetLastError = true, CallingConvention = CallingConvention.StdCall)] internal static extern IntPtr GetCurrentProcess(); - code to Call the when you want (in the execution method) to reduce the memory Foreign IntPtr = GetCurrentProcess (); SetProcessWorkingSetSize (exterior, - 1 , - 1 );