You are on page 1of 1

Private Declare Function SetProcessWorkingSetSize Lib "kernel32.

dll" (ByVal
hProcess As IntPtr, ByVal dwMinimumWorkingSetSize As Int32, ByVal
dwMaximumWorkingSetSize As Int32) As Int32
Friend Sub ReleaseMemory()
Try
GC.Collect()
GC.WaitForPendingFinalizers()
If Environment.OSVersion.Platform = PlatformID.Win32NT Then

SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1,
-1)
End If
Catch ex As Exception
ex.ToString()
End Try
End Sub

You might also like