1

I am developing windows application in VB.Net. My problem is after some time of running application commit size of memory get increased. I have used Memory profiler (Ant Profiler, CL R Profiler ) to identified the problem in application. it suggest me to dispose the object which is alive or not unregistered after close the form. Accordingly i dispose all the objects which can affect the memory leak.

But still cant get reduce the commit size once its go high.

Can anyone give me suggestion what to do?

Brijesh Patel
  • 2,901
  • 15
  • 50
  • 73

1 Answers1

0

The .NET garbage collector does not guarantee to free memory in any particular timeframe. It might, for example, wait until the memory is needed before freeing up used memory.

You can force a garbage collection by calling

GC.Collect 

These articles explain things in a bit more depth:

http://msdn.microsoft.com/en-us/library/ms973837.aspx

http://www.simple-talk.com/dotnet/.net-framework/understanding-garbage-collection-in-.net/

SSS
  • 4,807
  • 1
  • 23
  • 44
  • I did GC using GC.Collect and GC.SuppressFinalize(Me). but still not reduce it. it says that unused data cant not be dispose. in this case what to do? – Brijesh Patel Jul 24 '12 at 10:11
  • This thread might be helpful: http://stackoverflow.com/questions/1343374/reducing-memory-usage-of-net-applications – SSS Jul 25 '12 at 00:43