Click here to Skip to main content
Click here to Skip to main content
Go to top

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

, 20 Apr 2005
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.

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

Share

About the Author

Red Gate Software
Red Gate Software Ltd.
United Kingdom United Kingdom
Red Gate Software makes ingeniously simple tools used by over 650,000 Microsoft technology professionals working with .NET (incl. ASP.NET), SQL Server, Azure, and Oracle. More than 100,000 companies use our products, including 93% of the Fortune 100.

Our philosophy is to design highly usable, reliable tools which elegantly solve the problems that developers and database administrators face every day.
Group type: Organisation

4 members

Follow on   Twitter   Google+

Comments and Discussions

 
Generaldiscovering leaking object Pinmemberdclouzeau8-Jun-05 9:32 
GeneralRe: discovering leaking object Pinmembertch119-Jun-05 4:09 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 20 Apr 2005
Article Copyright 2005 by Red Gate Software
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid