This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Memory management in GCC.


Hi,

During parsing, some memory is allocated to build the AST (tree). 

Is  the memory  freed at  some point  in the  program, or  is  it kept
allocated untill the cc1 or cc1plus process dies ? 


I need  to know this because I'm  using GCC as a  front-end (for C++),
and I'm currently doing this:

  OK = toplev_main (argc, argv);
  if (OK != 0) {
    fprintf(stderr, "Error during parsing.\n");
    exit(OK);
  }
  fprintf(stderr, "\nParsing OK.\n\n");
  my_function_to_analyse_the_code();

I  modified slightly  the code  of GCC  to keep  some pointers  on the
interesting functions during parsing. 

This seems to be OK, but I'm affraid the trees be freed before I reach
my_function_to_analyse_the_code(),  in which case  I would  be reading
unallocated memory.

Thanks for your help,

-- 
Matthieu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]