Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Memory Leak Issues

Brew MP prints out debug messages when an module is unloaded without having released all memory. If an applet never exits and the applet's module never unloads, for example a daemon applet, then no memory leak message is shown for that module. Brew MP doesn't provide memory leak information for service objects.

The memory leak message contains the location of the heap allocation. If the memory leak is associated with object reference count leaks, the heap allocation often happens in Brew MP code, and it is hard for the developer to find the cause of the leak.

To use the Component Heap Tracker to debug memory leaks using the Simulator, choose a point in the application to begin tracking the heap, run the application, stop the application, and then determine whether the heap nodes allocated between these two points have been freed.

To look for memory leaks:

  1. On the Simulator Tools menu, select CHT.

    Heap nodes allocated are marked with call stack information and added to an internal hash table. When a heap node is freed, CHT will try to locate the node in the hash table. If a match is found the hash table entry is removed.

  2. Run the application.

    To create a log file while the application is running, on the Tools menu, select CHT Log.

  3. To stop tracking, on the Simulator Tools menu, select CHT.

    CHT creates a log file in the folder containing the CHT application that contains a list of the heap nodes that have not been freed.

On the device, call stack information is not available. Without this information, memory leak detection is not very useful.