Finding Memory Problems with gnatmem
gnatmem
, is a tool that monitors dynamic allocation and
deallocation activity in a program, and displays information about
incorrect deallocations and possible sources of memory leaks. Gnatmem
provides three type of information:
- General information concerning memory management, such as the total
number of allocations and deallocations, the amount of allocated
memory and the high water mark, i.e. the largest amount of allocated
memory in the course of program execution.
- Backtraces for all incorrect deallocations, that is to say deallocations
which do not correspond to a valid allocation.
- Information on each allocation that is potentially the origin of a memory
leak.
The gnatmem
command has two modes. It can be used with gdb
or with instrumented allocation and deallocation routines. The later
mode is called the GMEM
mode. Both modes produce the very same
output.