[PATCH] Improve PR29433, don't duplicate identifier names in dwarf2out

Richard Guenther rguenther@suse.de
Thu Nov 30 22:41:00 GMT 2006


On Thu, 30 Nov 2006, Andrew Pinski wrote:

> On Thu, 2006-11-30 at 17:18 +0100, Richard Guenther wrote:
> > This patch changes dwarf2out.c to not duplicate the strings in
> > identifier nodes as these are collected in an obstack that is never freed.
> > dwarf2out.c never frees any of the xstrduped stuff either.
> > 
> > This brings compile-time memory usage of PR29433 with -O0 -g down from
> > 3.9GB to 2.5GB which is about the same as for a -O0 compile.  (See the
> > C++ patch for PR29433 on how to bring this down to around 400MB).
> > 
> > Bootstrapped on x86_64-unknown-linux-gnu, tests still running.
> > 
> > Ok for mainline if they pass?
> > 
> > Thanks,
> > Richard.
> > 
> > :ADDPATCH debug:
> > 
> > 2006-11-30  Richard Guenther  <rguenther@suse.de>
> > 
> > 	PR c++/29433
> > 	* dwarf2out.c (struct pubname_struct): Make name const.
> > 	(add_pubtype): Do not xstrdup identifiers.
> 
> 
> 
> >                else
> >   	       e.name = xstrdup ((const char *) get_AT_string (die, DW_AT_name));
> 
> What about the above, I noticed we will not free that.  Or was that a
> bug before anyways?

Well, dwarf2out won't free any of the strings it xstrdups, I just fixed
the two cases where it xstrdups INDENTIFIER_NODEs strings (which turn to
be out 1GB of identifiers for that particular testcase).  I wouldn't be
surprised if a #define xstrdup(x) (x) for dwarf2out would bootstrap and
regtest ok (but there _must_ be a reason for duplicating all strings, 
right?).

Richard.

--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs



More information about the Gcc-patches mailing list