Applies to AQtime 8.71, last modified on December 5, 2018

This topic describes the specifics of profiling .NET applications with the Allocation profiler.

Preparing an Application for Profiling

In order to profile a .NET application with the Allocation profiler, you need to compile it with debug information. For a detailed description of how to configure various .NET compilers, see the topics of the Compiler Settings for .NET Applications section.

Searching for Memory Leaks in .NET

AQtime’s Allocation profiler monitors the application execution. It tracks creation and deletion of objects and allocation and deallocation of memory blocks. .NET Runtime releases memory when the application is being closed. Since AQtime normally generates results after the application run is over, the final statistics may not be very interesting, as all the created objects are already released. So, you will not be able to detect situation when the profiled application has some memory leaks that can cause memory overflow during the application run.

To trace such issues, you need to get profiling results during the application run rather than when the application closes. You can do this manually by selecting the Get Results command from AQtime’s menus or toolbars, or you can get results automatically by running the Get Results action on entering or exiting certain application functions. See below for details.

You can get results several times and compare them with each other to see whether memory is released when it should be. You can see summarized statistics in the Summary panel. Information on calls to memory management routines, on classes whose instances were created during the application run, as well as information on individual unreleased objects is displayed in the Report panel. For a detailed description of how to search for memory leaks and analyze the obtained results, see Search for Memory Leaks.

Getting Results Manually

To get results by using the Get Results command, do the following:

  1. Start profiling an application with the Allocation profiler.

  2. Wait until your application starts and work with it in a usual way: enter data, select menu items and so on. Your goal is to perform actions that lead (or may lead) to a memory leak.

  3. Capture the current profiling results. To do this, press Get Results on AQtime’s Standard toolbarselect Get Results from Visual Studio’s AQtime menuselect Get Results from AQtime's menu.

    Note: To clear the results before capturing them, you can explicitly start garbage collecting in the profiled application. To do this, click Force Garbage AQtime > Force Garbage Collection from Visual Studio’s main the Force Garbage Collection button in RAD Studio. This will clear the objects that are no longer used in your application. Then you capture profiling results to see which objects remained in memory after garbage collection.

    Note that the Force Garbage Collection button does not reside on any toolbar by default. You can add the button to any RAD Studio’s toolbar via the Toolbar Customization dialog. In this dialog, switch to the Commands page, select the Run.AQtime category in the Categories list, drag the Force Garbage Collection command from the Commands list and drop it on the needed toolbar.

Getting Results Automatically

Actions are commands that run automatically when an application enters or exits certain functions. To get results by using the Get Results action, do the following:

  1. Before you start profiling, switch to AQtime’s About Setup PanelSetup panel and create a Get Results action in the Setup panel. Add the needed routines to the created action. See Creating, Editing and Deleting Actions.

  2. Start profiling your application with the Allocation profiler.

  3. Perform some actions that may lead to a memory leak. When the specified action is performed, AQtime will automatically get the results.

See Also

Allocation Profiler - Overview
Allocation Profiler Tutorial
Search for Memory Leaks
Setup Panel
Profiling .NET Applications
Compiler Settings for .NET Applications

Highlight search results