-
"leaks" in .net
can anyone refer me to either good tools or reference articles for .NET memory management?
i am having some issues; i've been using memProfiler, and it helped me eliminate 90+% of the mem bloat i was experiencing, but it still says there are live instances of objects that, as far as i can tell, don't have any dangling references to them!
thanks in advance.
-
Are you sure the GC has run since the last reference was removed?
-
no; i'm not sure how to tell. i am calling GC.collect() though.
-
This is why I prefer handling my on memory management (i.e., using C/C++). It seems harder to me to find the objects that have been pinned in C#. Tracking down managed memory leaks (how to find a GC leak) - Rico Mariani's Performance Tidbits - Site Home - MSDN Blogs
-
i agree; i hate it, frankly. I highly prefer C++. unfortunately, that's not an option for me at present.
thanks for the links.
-
I have experienced these leaks as well and the GC is the laziest GC I've ever come across. There are several tools available that can help you. One is from MS and it is the CLR profiler. The most recent version is .NET 2.0 but I can confirm it works up to 3.5. It is a bit non-intuitive and the graphs are confusing at first but the summary page will tell you how many objects you have and what generation they are in. If you have a lot of dangling references your gen2 size will be pretty significant. There are several more but you will have to Google for them as I forget where I d/l them from.
Of course you can always tell the GC to collect but make sure you check out the params you can pass to this function. Call collect with no parameters is not recommended and will decrease your performance.