Troubleshooting guide
251
17: Testing applications
10. Repeat steps 1 through 8, setting breakpoints closer together until they converge on the memory leak.
Display objects in memory to locate object leaks
Object leaks can cause the JVM 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, or
RAM.
Use the Objects tool to locate a memory leak
1. In the BlackBerry® Integrated Development Environment, 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 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.
Status Description
Add or Delete This status appears when you perform a Compare to Snapshot to indicate new or removed
objects since the last snapshot.
Referenced by code or Referenced by static This status appears when a code (a local variable) or static data member references the
variable.