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

Memory Growth

Occurs when a block of memory is allocated but not deallocated within a specific time segment during application execution.

ID

Code Location

Description

1

Start site

Represents a point in time.

2

Allocation site

Represents the location and associated call stack of a memory block allocated but not deallocated between the start site and end site. There may be no, one, or many allocation site code locations in a Memory growth problem.

3

End site

Represents a point in time.

NOTE:

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).

Example

void ProcessTransaction(TransactionContext x)
{
   ...
   char* m = (char*) malloc(128);
   ...
   return;
}

void WaitForTransactions()
{
   ...
   for (;;)
   {
      TransactionContext x = WaitForTransaction(); // Report end site
      ProcessTransaction(x);
   }
}

In this example, if the user clicks the Reset Growth Tracking button, performs the transaction, and then clicks the Measure Growth button, the Intel Inspector reports a single allocation of 128 bytes within ProcessTransaction.

Possible Correction Strategies

Identify the leaked memory blocks that should have been freed and call the appropriate free routine during the lifetime of the transaction.

NOTE:

Intel Inspector does not perform a reachability analysis. Some of the reported memory blocks may:

  • Be already unreachable

  • Become unreachable later

  • Be deallocated later

  • Be still allocated but reachable when analysis ends