This reduces peak memory usage for -fdump-tree-all on tree.c with -O2 from several GB to a 200MB.
It helps really freeing obstacks ;) Testing in progress. Richard. 2013-11-25 Richard Biener <rguent...@suse.de> * pretty-print.c (output_buffer::~output_buffer): Really free the obstacks. Index: gcc/pretty-print.c =================================================================== *** gcc/pretty-print.c (revision 205352) --- gcc/pretty-print.c (working copy) *************** output_buffer::output_buffer () *** 50,57 **** output_buffer::~output_buffer () { ! obstack_free (&chunk_obstack, obstack_finish (&chunk_obstack)); ! obstack_free (&formatted_obstack, obstack_finish (&formatted_obstack)); } /* A pointer to the formatted diagnostic message. */ --- 50,57 ---- output_buffer::~output_buffer () { ! obstack_free (&chunk_obstack, NULL); ! obstack_free (&formatted_obstack, NULL); } /* A pointer to the formatted diagnostic message. */