public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Memory management in GCC.
@ 2003-05-19 13:08 Matthieu Moy
  0 siblings, 0 replies; only message in thread
From: Matthieu Moy @ 2003-05-19 13:08 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-19 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-19 13:08 Memory management in GCC Matthieu Moy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).