Friday, July 22, 2005

.NET memory leak




Tried to fix .NET (C#) memory leak.

Our software architecture is based on Apache, Tomecat, .NET remoting and .NET framework.

I used purifyplus from IBM (Rational) to profile our codes and found out the behavior for garbage collector of .NET platform is strange, it does not perform garbage collection until I force it to do so.

From the above observation, I decided to call GC.collect() in one of the thread in the program every 15 secs. It seems to be helpful. ( but why??)

I also fixed the DBConcurrencyException which could causes leak when it happens. DBConcurrencyException is thrown by the ADO.NET codes when the database data is out of sync with the memory version.

Also see:
http://www.c-sharpcorner.com/Code/2002/Aug/GCinNet.asp

http://www.codeproject.com/dotnet/garbagecollection.asp

http://www.developer.com/net/csharp/article.php/3343191

http://blogs.msdn.com/stevenpr/archive/2004/07/26/197254.aspx

http://memprofiler.com/


----------

0 Comments:

Post a Comment

<< Home