www.delorie.com/gnu/docs/gcc/gnat_ug_200.html   search  
Buy the book!

Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.2 Running 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 3.2 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

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003