Intel® Inspector User Guide for Windows* OS

ID 767798
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Find Memory Leaks On Demand

Intel Inspector distinguishes among Memory leak, Memory not deallocated, and Memory growth problem types in the following manner:

  • Memory leak problems occur when a block of memory is allocated, never deallocated, and not reachable (there is no pointer available to deallocate the block). Severity level = (Error).

  • Memory not deallocated problems occur when a block of memory is allocated, never deallocated, but still reachable at application exit (there is a pointer available to deallocate the block). Severity level = (Warning).

  • Memory growth problems occur when a block of memory is allocated, but not deallocated, within a specific time segment during application execution. Severity level = (Warning).

Intel Inspector customarily displays memory leaks at the end of an analysis run when an application exits; however, you can also use the Intel Inspector on-demand memory leak detection feature to gather memory leak information while an application is running. This is useful if:

  • An application does not terminate (such as a server process).

  • You want memory leak information, but you do not want to wait for an application to terminate.

  • You want to determine if memory is leaked during a specific interval of application execution, or during a specific user action.

  • You want to discard information about allocations performed during initialization as a way of filtering out allocations that are not currently of interest.

To find memory leaks on demand:

Prerequisites:

  • Select the Enable on-demand leak detection checkbox when configuring a memory error analysis.

  • Run the memory error analysis.

Steps:

  1. If desired, click the Reset Leak Tracking button on the Command toolbar to mark the start point of the time period during which you want to find memory leaks. (The default start point is the application start.)
    CAUTION:

    When you click this button, the Intel Inspector discards earlier allocation data and tracks leaks only in new allocations. Any new memory leaks on memory allocated prior to the button click do not appear in the result.

  2. When desired, click the Find Leaks button to find memory leaks in the current allocation set.
    Outcome: The Intel Inspector generates a Memory leak problem in the Summary window for any memory leak detected during the time period.
  3. Do one or more of the following:

    To Do This

    Do This

    Review the detected memory leaks.

    Click the Summary button to check for Memory leak problems.

    Continue finding memory leaks in the current allocation set.

    Repeat step 2.

    Discard earlier allocation data and search for memory leaks only in new allocations.

    Repeat steps 1 and 2.

  4. When you are finished, exit the application to end analysis, or simply let the analysis finish.
    Outcome: The Intel Inspector finalizes and displays the result.
TIP:

For more precision, consider using the GUI-based on-demand memory leak detection commands in tandem with APIs for custom memory allocation.