Use this to clean it up....very,very useful.
VB Code:
Public Class MemoryManagement Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" ( _ ByVal process As IntPtr, _ ByVal minimumWorkingSetSize As Integer, _ ByVal maximumWorkingSetSize As Integer) As Integer Public Shared Sub FlushMemory() GC.Collect() GC.WaitForPendingFinalizers() If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1) End If End Sub End Class
I found the above on the net because my DataGrid driven application was simply taking up too much memory on the client pc's.
I put this class into my project and call the FlushMemory function after each time a user fills a DataSet....my apps memory usage went from 30,000KB to less than 5,000KB!




Reply With Quote