.NET Memory Profiling Tools

.NetMemory ProfilingProfiling

.Net Problem Overview


> Possible Duplicate:
> What Are Some Good .NET Profilers?

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?

.Net Solutions


Solution 1 - .Net

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.

Solution 2 - .Net

Strange that CLR Profiler isn't mentioned here yet. It's free and works well.

Beware of the multiple old versions available from Microsoft's own site. As of Nov 2011, the latest version appears to be this one: latest version (alternate link)

Solution 3 - .Net

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

Solution 4 - .Net

Big fan of JetBrains Profiler myself

Solution 5 - .Net

.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.

Solution 6 - .Net

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.

Solution 7 - .Net

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.

Solution 8 - .Net

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.

Solution 9 - .Net

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionnick_alotView Question on Stackoverflow
Solution 1 - .NetBen RobbinsView Answer on Stackoverflow
Solution 2 - .NetCraig StuntzView Answer on Stackoverflow
Solution 3 - .NetX-CubedView Answer on Stackoverflow
Solution 4 - .NetannakataView Answer on Stackoverflow
Solution 5 - .NetjfsView Answer on Stackoverflow
Solution 6 - .NetdmajkicView Answer on Stackoverflow
Solution 7 - .NetDiadistisView Answer on Stackoverflow
Solution 8 - .NetFabriceView Answer on Stackoverflow
Solution 9 - .Netno_oneView Answer on Stackoverflow