Click here to Skip to main content
15,881,281 members
Articles / Product Showcase
Article

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

20 Apr 20052 min read 24.9K   3   2
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.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles 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.

Image 1

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.

Image 2

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


Written By
Red Gate Software Ltd.
United Kingdom United Kingdom
Redgate makes ingeniously simple software used by 804,745 IT professionals and counting, and is the leading Microsoft SQL Server tools vendor. Our philosophy is to design highly usable, reliable tools which elegantly solve the problems developers and DBAs face every day, and help them adopt database DevOps. As a result, more than 100,000 companies use products in the Redgate SQL Toolbelt, including 91% of those in the Fortune 100.
This is a Organisation

1 members

Comments and Discussions

 
Generaldiscovering leaking object Pin
dclouzeau8-Jun-05 9:32
dclouzeau8-Jun-05 9:32 
GeneralRe: discovering leaking object Pin
tch119-Jun-05 4:09
tch119-Jun-05 4:09 

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

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