Next: Switches for gnatmem, Previous: Running gnatmem (GDB Mode), Up: Finding Memory Problems with gnatmem
gnatmem
(GMEM Mode)
The gnatmem
command has the form
$ gnatmem [-q] [n] -i gmem.out user_program [program_arg]*
The program must have been linked with the instrumented version of the allocation and deallocation routines. This is done with linking with the libgmem.a library. For better results, the user program should be compiled with debugging options Switches for gcc. For example to build my_program:
$ gnatmake -g my_program -largs -lgmem
When running my_program the file gmem.out is produced. This file
contains information about all allocations and deallocations done by the
program. It is produced by the instrumented allocations and
deallocations routines and will be used by gnatmem
.
Gnatmem must be supplied with the gmem.out file and the executable to examine followed by its run-time inputs. For example, if a program is executed with the command:
$ my_program arg1 arg2
then gmem.out can be analysed by gnatmem
using the command:
$ gnatmem -i gmem.out my_program arg1 arg2