Identifying memory leaks

The memory leak analysis views identify the objects that are likely to be leaked memory. This information allows you to correct your code and fix the leak.

Prerequisite: Generating a list of leak candidates

The Leak Candidates view displays the most likely leaks that occurred during between the two heap dumps that you analyzed. These candidates are objects within the heap (such as arrays, vectors, and session classes). Each candidate is assigned a likelihood value between 1 and 100 (100 is assigned to the most likely candidate); the view displays only candidates with a value above the threshold value that you assigned. The view identifies the root of the leak (the object that is holding references to the potentially leaked objects), the container of the leaked object, and the type of leaked object. It also indicates the number of leaks, the number of bytes leaked, and the number of objects leaked (that is, objects currently held by the leaking objects).

To identify memory leaks:

  1. Double-click a leak candidate to display the Object Reference Graph view. The graph highlights the root of the leak and the path to the leaked object.

  2. Pause your cursor over any object or path segment to display statistical information. Look for large amounts of allocated memory.

  3. Double-click a node in the Object Reference Graph view to display detailed information about the node in the Object Details view. The Object Details view allows you to see all the data for an object together, including a list of all the objects that refer to the current object, and a list of all the objects to which the current object refers. You can click on any item in these lists to navigate up and down the chain of object references.

  4. If you find evidence that objects remain allocated longer than is necessary, fix your code so that any lingering references are released in a timely manner.

 

Parent topic

Analyzing memory leaks

 

Related tasks

Generating a list of leak candidates
Saving leak analysis data

Related reference
The Leak Candidates view
The Object Reference Graph view
Object Reference Graph data commands
The Object Details view