Observe changes in memory usage (allocations and deallocations)

It is important for you to know when and where memory is being consumed within an application. The Memory Analysis tool includes several views that use the trace data from the Memory Analysis session to help extract and visually show this information to determine memory usage (allocation and deallocation metrics). Showing this information using various charts helps you observe the changes in memory usage

The Momentics IDE includes the following tabs to help you observe changes in memory over time:

To access these tabs:

  1. Select Window > Show View > Other.
  2. Select QNX System Information > Malloc Information.
  3. Click OK.

To begin to view data on your graphs, you need to set logging for the target, and you need to select an initial process from the Target Navigator view.

These charts show the memory usage and the volume of memory events over time (the allocation and deallocation of memory). These views reflect the current state of the active editor and active editor pane. You can select an area of interest in any of the charts; then, using the right-click menu, zoom in to show only that range of events to quickly isolate areas of interest due to abnormal system activity.

Inspect outstanding allocations

Outstanding allocations are memory allocations that are currently active (that is, not freed). Sometimes, they are valid allocations, and sometimes they are implicit memory leaks. Since an allocation pointer is used, it can't be detected as a memory leak; to validate that an allocation is required, you have to manually inspect it.

To manually inspect outstanding allocations:

  1. Open the Memory Events view and click a desired session to populate it.
  2. Select the Filter… option from the context menu.
  3. Select the Hide matching allocation/deallocation pair option and click OK.
  4. Select the Group By Backtrace option from the context menu.
  5. Review the results (only those allocations that remain in memory, or were in memory at the moment of the exit).
  6. Select one allocation from the table.
    The Memory Backtrace view becomes populated with the current stack trace for the selected event.
  7. Optional: To inspect allocations that only occurred between certain time intervals, use the Quick Filter option from the context menu to restrict the events range.

Outstanding allocations

This graph shows the total allocation of memory within your program over time for the selected process.

Screen showing outstanding allocations.

If you compare it to the Overview History tab, you can see the trend of how memory is being allocated within your program.

Screen showing outstanding allocations.

Allocation deltas

This graph shows the changes to the allocation of memory within your program over time for the selected process. From this type of graph, you can observe which band(s) has the most activity.

Screen showing allocation deltas.

Deallocation deltas

This graph shows the changes to the deallocation of memory within your program over time for the selected process from the Target Navigator view. From this type of graph, you can observe which band(s) has the least activity.

Screen showing deallocation deltas.

Outstanding allocation deltas

This graph shows the differences between the memory that was allocated and deallocated for the selected process; it shows a summary of the free memory. From this graph, you can observe which band(s) might be leaking memory, and by how much.

Screen showing outstanding allocation deltas.

Last modified: 2015-07-24



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

comments powered by Disqus