Question

I am working on a C# 4.0 managed code application. I am using external DLLs which are not CLS compliant.

Do I need a memory leak detection tool to check for memory leaks in the DLLs? If yes what are the best tools out there?

Was it helpful?

Solution

You can use a tool like CLR Profiler,VSTS Profiler, .NET Memory Profiler or CLR Profiler to check your object size etc, as they say you can Find Memory Leaks and Optimize Memory Usage in any .NET Program.

OTHER TIPS

Even in managed code, you can have memory leaks. I would not dig into memory leaks unless you actually find one, though.

If you do need to look into a leak, then I would suggest ANTS Profiler, however this has its limits, so it should be taken on a case by case basis.

Yes, it is possible to have memory leaks in .NET. It is even possible to have them when you're using nothing but the base class library, because many of those classes themselves make calls into unmanaged code.

I once had a memory leak because I didn't dispose a System.DirectoryServices.SearchResultCollection after enumerating over it.

However, I don't know what leak detection tools might be available.

You can use the free WinDbg, SOS and GCRoot do diagnose memory leaks. David Anson shows you how on this blog post. Rico Mariani also has a good blog post on using WinDbg and SOS.

Other products like JustTrace, dotTrace and ANTS Profiler can help you diagnose these kinds of issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top