Attaching Memory Analysis to a running process

If you want to start analyzing heap activity or finding memory errors for a running process, you can attach the Memory Analysis tool. The IDE then displays the librcheck data received from the target, to illustrate the process's heap allocations and list any memory problems.

Note: The application that you want to analyze must have been run with librcheck. Also, your host machine must have an IP connection to your target machine.
To attach Memory Analysis to a running process:
  1. In the launch bar, expand the Launch Configuration dropdown (which is in the middle) and select the application for which you want to see memory data.
  2. In the Launch Target dropdown (on the right), select the target on which the application is running.
  3. In the Launch Mode dropdown (on the left), select Attach.
  4. Click the Edit button (Icon: Edit button) on the right of the Launch Configuration dropdown.
  5. Enable Memory Analysis in the launch configuration:
    1. Click the Tools tab on the right.
    2. Click the Memory Analysis radio button.
    3. Optional: If needed, configure any tool settings to customize what gets reported.
    4. Optional: Enable or disable other analysis tools.

      You can disable the debugger if need be, by unchecking the box at the top of the Debug tab.

      We recommend that you don't run Memory Analysis at the same time as the GDB debugger because the setup needed to prevent the program from crashing is more complicated. If you have to run both tools concurrently, you must follow the steps given in Running Memory Analysis and the GDB Debugger concurrently instead of the remaining steps given here.

      You can also run the System Profiler (by checking this tool's box at the bottom of the Tools tab), to perform a kernel event trace while gathering memory data.

  6. When you've finished configuring the tools, click OK to save the changes and exit the window.
  7. Click the Attach button (Icon: Attach button).
    The IDE switches to the Debug perspective if the debugger is enabled, or the QNX Analysis perspective if it's not, then opens the Select Process popup window. This window lists the processes with the same name as the binary specified in the Main tab.
  8. Click the process that you want to attach to, then click OK.

The IDE attaches Memory Analysis and any other enabled tools to the selected process. In the current perspective, you'll see a new session for storing the debugging or analysis results. Depending on the active tools and their configuration, these results might get updated as the program runs.

In the QNX Analysis perspective, you can see the librcheck statistics displayed by the Memory Analysis tool. The Memory Analysis reference explains how to interpret the results.