Review: Red Gate ANTS Memory Profiler 7.0

Diagnose memory-consumption issues in your .NET application

Rating: 4 out of 5 stars
Website: www.red-gate.com/products/dotnet-development/ants-memory-profiler
Price: $495

One of the biggest advantages of a modern language such as C# is that it runs within the CLR, which inherently handles garbage collection. Because of its garbage-collection functionality, the CLR does a great job at helping programmers improve memory management. However, this feature can become a double-edged sword, as it can promote lazy coding practices that bloat resources when objects are not managed effectively. And even for the experienced developer, finding the proverbial needle in the haystack as it relates to memory consumption issues in a .NET application can quickly become an exercise in frustration.

Fortunately, the talented team at Red Gate Software offers a product that can turn this aggravation into something much more positive and even educational. Red Gate's ANTS Memory Profiler, now in its seventh iteration, provides .NET developers with a tool that plumbs the depths of .NET compiled executables; ASP.NET, Silverlight 4, and COM+ applications; XAML Browser Applications (XBAPs); and more. Figure 1 shows the various application types that the product generates profiles for.

129717_Red_Gate_ANTS_Figure1_0

Figure 1: Selecting from the many Windows-based application types that ANTS can analyze

For example, by using just one line of code, you can generate specific memory snapshots of up to 2GB (4GB on Windows 64-bit) for a program. And while ANTS Memory Profiler can be run as a standalone tool, it also works perfectly well within Visual Studio 2010, 2008, and 2005 environments. All .NET languages can be profiled as long as they run on top of .NET Framework versions 1.1 through 4. And for .NET Framework 4 developers, this version of ANTS Memory Profiler can attach itself to a running .NET Framework 4 process, so that an application can be profiled without interrupting its execution.

Easy Configuration, Excellent Data Visualization
ANTS Memory Profiler stands out in the relatively crowded application memory-profiling category because of its easy configuration and excellent reporting and data-visualization facilities. The Summary tab, shown in Figure 2, displays specific details about the application that’s being profiled, memory snapshots, and comparisons of snapshots.

129717_Red_Gate_ANTS_Figure2_0

Figure 2: Reviewing the summary of a memory snapshot

Its instance categorizer does a great job organizing class instances being held in memory for the same reasons. This feature helps developers hone in on problem areas that can choke performance or cause memory resource consumption to balloon.

With all the data being captured by each memory snapshot, it would be a grueling task to manually comb through all the information. Fortunately, ANTS has a powerful set of intuitive filters, shown in Figure 3, which help developers spot trouble areas.

129717_Red_Gate_ANTS_Figure3_0

Figure 3: Available filtering choices that can be used to narrow results

Filters for objects as they relate to disposable GC roots; reference associations; generation 0, 1, 2 garbage collections; large heaps; or zombie types allow developers to slice and dice the profiling data in ways that help quickly identify the root causes of pesky and elusive memory-management issues.

The instance-retention graph, shown in Figure 4, is another cool feature that displays the chain of instance references being held in memory.

129717_Red_Gate_ANTS_Figure4_0

Figure 4: Using the instance retention graph to identify garbage collection problems

Instance reference retention is a factor that can lead to common memory problems that prevent the .NET garbage collector from properly reclaiming resources. Fortunately, the graph does a nice job of displaying where these instance problems may arise. However, depending on the depth of object relationships, this graph can grow rather large, making it a chore to scroll back and forth or up and down. Scrolling can also become difficult on the instance categorizer screen. For complex programs, it's good to use an HD monitor. Or better yet, use two HD monitors to easily display a larger graph area on one monitor while running the application on the other.

You can download a two-week trial from Red Gate's website. Red Gate also provides a comprehensive walk-through and videos for those interested in seeing the product in action.

Desired Improvements for the Next Version
Now that Windows Phone 7 is available, it would be awesome if the next release of ANTS Memory Profiler could spin the same magic with Silverlight- and XNA-based mobile applications that it currently does with PC-based mobile applications. Given the resource constraints that a mobile platform imposes on developers, this would be an especially welcome development. I’d also like to see ANTS Memory Profiler work with non-Red Gate coverage and profiling suites. This would help developers consolidate reports into a broader application testing summary report for management review.

Another issue is that ANTS focuses strictly on managed memory, leaving unmanaged memory profiling up to other tools outside the .NET CLR realm. On their website, Red Gate does offer a write-up about checking unmanaged memory usage by using ANTS Memory Profiler, so it is possible to tweak the program to identify unmanaged issues, albeit in a less-than-elegant way.

Application Performance Insight
Overall, Red Gate's ANTS Memory Profiler is a must-have tool for .NET developers seeking a better understanding of their .NET applications, especially those who bump up against resource management issues. And thanks to its one-step setup dialog box, the tool is so intuitive that its users can be hugely productive minutes after launching it for the first time. Nice job, Red Gate.

Mike Riley ([email protected]) is an advanced computing professional specializing in emerging technologies and new development trends. He is also a contributing editor for DevProConnections. Follow Mike on Twitter @mriley.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish