Ok, there has been a number of complaints about programs written in the .NET Framework using lots of memory. Here is a way to reduce it using P-Invoke.
You need to import the function SetProcessWorkingSetSize.
Now call the function. You can place this in the constructor.VB Code:
<DllImport("kernel32.dll")> _ Public Shared Function SetProcessWorkingSetSize(ByVal handle As IntPtr, _ ByVal min As Int32, _ ByVal max As Int32) _ As Boolean End Function
VB Code:
Dim proc As Process = Process.GetCurrentProcess() Me.SetProcessWorkingSetSize(proc.Handle, -1, -1)
C# Version
Code:[DllImport("kernel32.dll")]
public static extern bool SetProcessWorkingSetSize(System.IntPtr handle, int min, int max);
Also, make sure you have a reference to System.Diagnostics and System.Runtime.InteropServices.Code:Process proc = Process.GetCurrentProcess();
SetProcessWorkingSetSize(proc.Handle, -1, -1);
