Click here to Skip to main content
Click here to Skip to main content

ANTS Profiler: How to reduce the number of objects that you see in the 'All objects' panel

By , 20 Apr 2005
 

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

Previously we have written about profiling performance and profiling memory with ANTS Profiler. This time we’re going to present a short tip for using ANTS Profiler, explaining how ANTS Profiler lets you quickly reduce the number of objects that you are looking at.

A common problem with profiling the memory of a .NET application is that there are an awful lot of objects to look at. Searching through a large number of objects, just to find the ones that you are interested in, is both time consuming and frustrating. In ANTS Profiler you can quickly reduce the number of objects that you are looking at by a careful use of grouping, filtering and sorting.

Let us walk through the steps for one of my typical scenarios – comparing the differences between two snapshots.

Quite often I use the memory profiler to find out what new objects are created when I execute a certain action (e.g. click on a button). To do this, I take a snapshot of the memory before I perform the action, and then another snapshot after the action. The screenshot below shows "All objects" from the second snapshot.

To focus on new memory created I immediately filter using the Comparison column to only show "New" objects that have been created since the previous snapshot. This immediately reduces the number of objects displayed in the grid from thousands to hundreds.

My next step is usually to group the objects by their "Namespace". This allows me to focus on all the objects from a particular namespace. Shown below is a screenshot of the grouped results focusing on the ShapePainter namespace.

I can now see immediately that the action that I performed resulted in the creation of 10 new rectangle shapes.

Expanding the System.Drawing namespace grouping reveals that I am creating a very large number of SolidBrush objects. I might want to take some more time to find out whether I really need to be creating so many new Solid Brushes!

Obviously you can choose to filter or group on any of the columns that are available in the "All objects" grid. It may well prove useful to filter out all the objects that do not have a source file so that you can focus on the objects created by your code, or group by allocation method to see which methods are creating the most objects.

Try it out for yourself – download a fully-functional, free trial from Red Gate’s website.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Red Gate Software
Red Gate Software Ltd.
United Kingdom United Kingdom
Member
Organisation
4 members

Red Gate Software produces ingeniously simple tools for Microsoft technology professionals worldwide. We currently specialize in MS SQL Server, Cloud, .NET and Oracle database tools. Established in 1999, we are based in the beautiful, if rather flat, university town of Cambridge, UK

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generaldiscovering leaking objectmemberdclouzeau8 Jun '05 - 9:32 
GeneralRe: discovering leaking objectmembertch119 Jun '05 - 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 20 Apr 2005
Article Copyright 2005 by Red Gate Software
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid