Hello developers,
I have created an executable(syst em tray application) in VS.net 2003
using VB.net. My app was taking 30 MB memory(since some web services
call are there which happens for each 10 sec checking internet is
available or not). Inorder to reduce huge memory consumption, what i
used is
Public Class MemoryManagemen t
Private Declare Function SetProcessWorki ngSetSize Lib
"kernel32.d ll" ( _
ByVal process As IntPtr, _
ByVal minimumWorkingS etSize As Integer, _
ByVal maximumWorkingS etSize As Integer) As Integer
Public Shared Sub FlushMemory()
GC.Collect()
GC.WaitForPendi ngFinalizers()
If (Environment.OS Version.Platfor m = PlatformID.Win3 2NT) Then
SetProcessWorki ngSetSize(Proce ss.GetCurrentPr ocess().Handle, -1, -1)
End If
End Sub
End Class
Now i call FlushMemory on every 10 secs.
Now the memory consumption got reduced to 2 MB..But the problem is
after running this application for several days continously(say 1 week)
i got .net memory leak exception. I heard that .net memory exception
comes only if your application doesnot leave memory when other apps
need it. Can anyone guide me correctly...
Any help in this regard is greatly appreciated.... ..
Regards,
Anand. A.V