views:

1976

answers:

8

Hello, I am on the lookout for good .NET CLR memory profiling tools.

My key requirement is that it will play well with IIS and standalone CLR Apps. Ideally I would see what objects are allocated, where they are allocated and what size they are?

Does anyone have any good experiences with a particular tool that you would be happy to recommend?

+5  A: 

.Net Memory Profiler helped me a lot on my previous project. It's not free but it's very good.

.NET Memory Profiler is a powerful tool for finding memory leaks and optimizing the memory usage in programs written in C#, VB.NET or any other .NET Language.

John
Thanks John - I will take a look. BTW - What an original product name!
nick_alot
+5  A: 

Big fan of JetBrains Profiler myself

annakata
+2  A: 

I'm currently using ANTS Profiler. It's a very good tool with many profiling detail options and plays well with stand-alone applications, development server and IIS.

Diadistis
+3  A: 

I second ANTS profiler.

Beside showing all you need, it will draw simple graph where you can see what takes longest to execute, and what eats memory. When you click on graphp it will show you the coresponding line in your code.

And I like litle progress bars drown on code lines which take too long to execute.

dmajkic
A: 

I have used Aqtime with great success over the years. I tried ANTS and others but went back to Aqtime as I also do a lot of development in unmanaged code.

no_one
+5  A: 

I'm currently evaluating both the Scitech .NET Memory Profiler 3.1 and ANTS Memory Profiler 5.1. I tried the JetBrains one a year or two ago and it wasn't as good as ANTS so I haven't bothered this time. From reading the web sites it looks like it isn't as good for memory profiling as the other two.

Both ANTS and the Scitech memory profiler have features that the other doesn't, so which is best will depend upon your preferences. Generally speaking, the Scitech one provides more detailed information while the ANTS one is really incredible at identifying the leaking object. Overall, I prefer the ANTS one because it is so quick at identifying possible leaks.

Here are the main the pros and cons of each from my experience:

Common Features of ANTS and Scitech .NET Memory Profiler

  • Real-time analysis feature
  • Excellent how-to videos on their web sites
  • Easy to use
  • Reasonably performant (obviously slower than without the profiler attached, but not so much you become frustrated)
  • Show instances of leaking objects
  • Basically they both do the job pretty well

ANTS

  • One-click filters to find common leaks including: objects kept alive only by event handlers, objects that are disposed but still live and objects that are only being kept alive by a reference from a disposed object. This is probably the killer feature of ANTS - finding leaks is incredibly fast because of this. In my experience, the majority of leaks are caused by event handlers not being unhooked and ANTS just takes you straight to these objects. Awesome.
  • Object retention graph. While the same info is available in Scitech, it's much easier to interpret in ANTS.
  • Shows size with children in addition to size of the object itself (but only when an instance is selected unfortunately, not in the overall class list).
  • Better integration to Visual Studio (right-click on graph to jump to file)

Scitech .NET Memory Profiler

  • Shows stack trace when object was allocated. This is really useful for objects that are allocated in lots of different places. With ANTS it is difficult to determine exactly where the leaked object was created.
  • Shows count of disposable objects that were not disposed. While not indicative of a leak, it does identify opportunities to fix this problem and improve your application performance as a result of faster garbage collection.
  • More detailed filtering options (several columns can be filtered independently).
  • Presents info on total objects created (including those garbage collected). ANTS only shows 'live' object stats. This makes it easier to analyze and tune overall application performance (eg. identify where lots of objects being created unnecessarily that aren't necessarily leaking).

By way of summary, I think ANTS helps you find what's leaking faster while Scitech provides a bit more detail about your overall application memory performance and individual objects once you know what to look at (eg. stack trace on creation). If the stack trace and tracking of undisposed disposable objects was added to ANTS I wouldn't see the need to use anything else.

Ben Robbins
+1  A: 

If you're feeling really desperate, you can use WinDbg with the Son-of-Strike library (SOS.DLL) that ships with the .Net framework.

X-Cubed
actually, this is far more useful for really obscure memory issues, such as when you're holding a reference in a non-obvious place
Steve
+2  A: 

Since everyone's listing the available tools, I thought I'd point you to the complete list of profilers for .NET: http://sharptoolbox.com/categories/profilers-debuggers

You'll find there the tools suggested here and all the other ones, each with a short description of what it proposes.

Fabrice