Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
wiki1247: MemoryAnalysis (Version 2)

Overview#

The QNX Momentics memory analysis tool combines powerful visualization features with an innovative method of databasing memory usage, allowing developers to quickly pinpoint memory errors and leaks, and optimize memory usage.

The memory analysis tool helps developers visualize the memory usage of programs, and can quickly detect buffer overruns, invalid deallocations, and other common memory errors. It provides:

  • unique visualization tools that provide graphical views of memory profiles
  • process-level views that quickly identify a program's memory map - colored regions represent the stack, program, library, and heap components
  • specialized statistics for the system memory allocator for quickly detecting possible memory leaks - statistics include the total number of bytes and blocks that are free, allocated, and in use
  • dynamic history of memory usage for identifying trends

Catch memory errors using the allocation library#

QNX Momentics provides an allocation library with cover routines for most string and memory operations. These routines check the integrity of memory before using it, allowing developers to catch errors such as overruns, underruns, invalid use of memory, and freeing the same memory twice. Once an error is found, a convenient back trace places shows the code editor at the offending line of code. These bugs can be fixed and retested quickly before submission to a project's build.

MemoryAnalysis/mat_screenshot.gif

Choose the best method for dealing with errors#

The memory analysis tool intelligently tracks each memory error as a task, and automatically annotates the program source with a warning. When a memory error is detected, developers can:

  • let the program continue uninterrupted
  • terminate the program and generate a process core dump file
  • stop the program and immediately switch control to the debugger view, where the debugger feature pinpoints the problem

In each case the memory analysis tool indicates the source of the problem along with a call stack trace indicating the path that caused the error. Fixes are quickly made and tested.

Profile memory usage for in-depth understanding#

Understanding the memory profile of a system is key to optimizing memory resources. The memory analysis tool tracks all memory allocations and deallocations and displays these in a time-ordered fashion to assist in understanding when, where, and how memory is being used.

Optimize memory resources#

Using memory profiling technology, the memory analysis tool can help indentify opportunities to optimize memory usage. For example, memory profiling may reveal heavy memory usage of a certain size at fixed intervals. The memory profile indicates when the memory is allocated, where it's allocated in the code, how often and at what time intervals. Unwanted allocations can then be easily traced to the code where developers can implement a more efficient scheme.

Resources#