Memory management in GCC.
Matthieu Moy
Matthieu.Moy@imag.fr
Mon May 19 13:08:00 GMT 2003
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
More information about the Gcc
mailing list