This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Memory management in GCC.
- From: Matthieu Moy <Matthieu dot Moy at imag dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 19 May 2003 14:58:41 +0200
- Subject: Memory management in GCC.
- Organization: Verimag, STMicroelectronics
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