PreviousNext

Display objects in memory to locate object leaks

Object leaks can cause the VM to run out of flash memory, which forces a BlackBerry® device to reset.

Display format

The Name column displays each process in the following format: process_name(process_id): status

where status is one of the following: Add, Delete, Referenced by code, Referenced by static, Grouped, Persistent, RAM.
Status
Description

Add or Delete

This status appears when you perform a Compare to Snapshot to indicate objects added or deleted since the snapshot was taken.

Referenced by code or Referenced by static

This status appears when the variable is being referenced by code (a local variable) or static data member.

Use the Objects tool to find a memory leak

    1. In the BlackBerry® IDE, on the Debug menu, click Go.
    2. On the Debug menu, click Break Now.
    3. On the View menu, click Objects.
    4. In the objects pane, click GC.
    5. In the objects pane, click Snapshot.
    6. On the Debug menu, click Continue.
    7. Perform operations in the application that do not increase the number of reachable objects. For example, create a new contact and then delete it.
    8. On the Debug menu, click Break Now.
    9. In the objects pane, click GC.
    10. Click Compare to Snapshot.

      The objects pane displays the number of objects that have been deleted and added since the previous snapshot. If the number of objects added is not the same as the number of objects deleted, you might have an object leak. To narrow new objects, use the Type, Process, and Location filters located at the top of the objects pane.

    11. To save the contents of the objects pane to a comma separated values (.csv) file, click Save.

Show references to or from an object

> In the objects pane, right-click an object, and then click Show References to or Show References From.

The object view narrows to show only the objects that have references to or from this object. Use the Forward and Back buttons to move back and forth through the reference chain.

Right-click an object, and then click Show Recursive References To @nnnnnnnn to display all objects that reference the selected object. An object can be displayed indirectly through another object.

Note: This operation might take a long time.

View the source code or static data member

    1. Double-click Code referencing @nnnnnnnn or Static referencing @nnnnnnnn line.
    2. Click Forward and Back to move through the list of referenced objects.

View all objects that reference a list of objects

    1. In the Objects pane, right-click an object.
    2. Click Show references to this object list.

View a list of references between two objects

    1. In the Objects pane, right-click an object.
    2. Click Show path from @NNNNNNNN to @MMMMMMMM.

Related topic


   BlackBerry