Minimizing memory usage

The QNX Memory Analysis perspective shows you how your app uses memory. The perspective helps you find memory errors, including memory leaks and memory errors, in your app before you release it.

When you use the QNX Memory Analysis perspective, make sure that only one Momentics IDE for BlackBerry is connected to the target device. The QNX Memory Analysis perspective might produce incorrect results when more than one Momentics IDE is communicating with the same device.

When you launch your app with the Memory Analysis tool, your app uses the debug version of the malloc library, (although you can still use, to obtain memory statistics, use This library tracks the history of every allocation and deallocation of memory, and provides cover functions for the string and memory functions (for example, strcmp, memcpy, memmove). Each cover function validates the corresponding function's arguments before using them. For example, if you allocate 16 bytes, then forget the terminating NULL character and attempt to copy a 16-byte string into the block using the strcpy function, the library detects the error.

The debug version of the malloc library uses more memory than the nondebug version. When tracing all calls to malloc, the library requires additional CPU overhead to process and store the memory-trace events.

If you intend to run simultaneous Memory Analysis tooling sessions, you need to use different storage files. For example, if you want to have two sessions running at the same time, you have to specify different files to log the trace.

Analyze memory use

When you perform memory analysis for an app, you select a launch configuration and a device to analyze. The Momentics IDE builds the app with the corresponding build configuration (either Device-Debug or Simulator-Debug), and then launches the app with the selected configuration. You don't need to build the app, configure the build configuration, or configure the launch configuration, because the Momentics IDE does it for you.

  1. In the Launch configuration drop-down list, click the launch configuration for your project.
  2. In the Launch mode drop-down list, click Memory Analysis.
  3. In the Launch target drop-down list, click a device or simulator. To resolve any device connection issues, click Momentics IDE edit icon and follow the instructions on the Device Properties dialog box.
  4. Click Momentics IDE launch button.

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus