I think what everyone has said has been good. If a memory leak is suspected, I would go and make sure that you make sure several are done in your code.
1. As a general practice, I always implement the IDisposable interface and put whatever clean up routines in it even if I do not have any unmanaged code. If I do have unmanaged code, I place the clean up statements in here as well. One thing that I also do (although I am not completely recommending it) is call the GC.SuppressFinalize() statement in the Dispose method so that when the garbage collector tries to clean up the object, it does not call the finalizer statement but simply releases the memory. It is a small performance boost. In essence what it is saying is that I have already done ALL of the clean up necessary for the object, there is no need to call the finallizer of the object, go ahead and release the memory. 2. When coding, I ALWAYS call the Dispose methods of objects and/or set the object to null (or nothing in VB). Some people say that it isn't necessary to do all that because in a managed environment like .NET, the Garbage Collector does all of that for you. I think it is good programming practice to ALWAYS clean up your resources when you are completed with them. Following these techniques, I do not get memory leaks. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Ding Sent: Wednesday, September 05, 2007 12:17 PM To: Discussion of advanced .NET topics. Subject: RE: [ADVANCED-DOTNET] l immediately release any unneeded memory Q: Why do you want to do it yourself? A: One customer noticed service process had a large number of pages in use and worried about a memory leak. Sincerely, Tracy Ding -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Steele Sent: Wednesday, September 05, 2007 9:40 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] l immediately release any unneeded memory No. The garbage collector handles that for you. If you're utilizing unmanaged resources (files handles, windows handles, etc...), implement the IDisposable interface to make sure you release the resources. Why do you want to do it yourself? --- Patrick Steele http://weblogs.asp.net/psteele -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Ding Sent: Wednesday, September 05, 2007 12:35 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] l immediately release any unneeded memory Is there some sort of .NET call that will immediately release any unneeded memory for service process? =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com