This is the mail archive of the gcc-patches@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]

[PATCH] Fix pretty-printer leak


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  <rguenther@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.  */


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