I have a question about SetProcessWorkingSetSize function. If i have a bunch of object, lets say forms, open in the back ground without me saying form = nothing or form.dispose, how does SetProcessWorkingSetSize treat this? Does SetProcessWorkingSetSize end ALL processes that are going on except the current one and From1? Or what does it do to the program it self?
Thank you
Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal dwMinimumWorkingSetSize As Int32, ByVal dwMaximumWorkingSetSize As Int32) As Int32
Public Function SaveMemory() As Int32
GC.Collect() 'calls garbage collector
GC.WaitForPendingFinalizers() 'collets and destroyes deallocated objects
If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then 'Checks the version of the OS
Return SetProcessWorkingSetSize(Diagnostics.Process.GetCurrentProcess.Handle, -1, -1) 'swaps one process for another
End If
End Function