Reclaim Memory in .Net Application

It is not a good idea to call garbage collector explicitely .. use this code to
a) You need to cleanup a very large object
b) Things are out of control and your application is eating megs and megs of memory ... and you need to give an important release. Here is the lifesaver.

public static void ReclaimMemory()
SetProcessWorkingSetSize( Process.GetCurrentProcess().Handle, -1, -1 );


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: