A recent patch decreased GCC's memory consumption.

gcctest@suse.de gcctest@suse.de
Mon Feb 20 17:18:00 GMT 2006


Hi,

I am a friendly script caring about memory consumption in GCC.  Please
contact jh@suse.cz if something is going wrong.

Comparing memory consumption on compilation of combine.i, insn-attrtab.i,
and generate-3.4.ii I got:


comparing combine.c compilation at -O0 level:
    Overall memory needed: 25340k -> 25352k
    Peak memory use before GGC: 9567k
    Peak memory use after GGC: 8914k
    Maximum of released memory in single GGC run: 2648k
    Garbage: 40060k
    Leak: 6741k
    Overhead: 5738k
    GGC runs: 313

comparing combine.c compilation at -O1 level:
    Overall memory needed: 26900k
    Peak memory use before GGC: 17435k
    Peak memory use after GGC: 17256k
    Maximum of released memory in single GGC run: 2309k
    Garbage: 62593k -> 62363k
    Leak: 6880k -> 6880k
    Overhead: 7485k -> 7473k
    GGC runs: 393 -> 391

comparing combine.c compilation at -O2 level:
  Amount of produced GGC garbage decreased from 87438k to 82351k, overall -6.18%
    Overall memory needed: 26900k
    Peak memory use before GGC: 17438k
    Peak memory use after GGC: 17256k
    Maximum of released memory in single GGC run: 3620k -> 2400k
    Garbage: 87438k -> 82351k
    Leak: 6974k -> 6974k
    Overhead: 10540k -> 10197k
    GGC runs: 465 -> 462

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting run decreased from 19231k to 18434k, overall -4.32%
  Amount of produced GGC garbage decreased from 120003k to 113617k, overall -5.62%
    Overall memory needed: 26900k
    Peak memory use before GGC: 19231k -> 18434k
    Peak memory use after GGC: 18482k -> 17993k
    Maximum of released memory in single GGC run: 4967k -> 3496k
    Garbage: 120003k -> 113617k
    Leak: 7056k -> 7053k
    Overhead: 14423k -> 13932k
    GGC runs: 520 -> 518

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 80952k -> 80948k
    Peak memory use before GGC: 69509k
    Peak memory use after GGC: 45045k
    Maximum of released memory in single GGC run: 36220k
    Garbage: 146686k
    Leak: 9892k
    Overhead: 19751k
    GGC runs: 247

comparing insn-attrtab.c compilation at -O1 level:
  Ovarall memory allocated via mmap and sbrk decreased from 114184k to 109264k, overall -4.50%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 96842k to 92084k, overall -5.17%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 84874k to 81243k, overall -4.47%
    Overall memory needed: 114184k -> 109264k
    Peak memory use before GGC: 96842k -> 92084k
    Peak memory use after GGC: 84874k -> 81243k
    Maximum of released memory in single GGC run: 32383k -> 32384k
    Garbage: 304573k -> 296569k
    Leak: 10073k
    Overhead: 37280k -> 36195k
    GGC runs: 246

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 111584k
    Peak memory use before GGC: 98561k
    Peak memory use after GGC: 84975k
    Maximum of released memory in single GGC run: 31927k
    Garbage: 351852k -> 351824k
    Leak: 10057k -> 10057k
    Overhead: 45866k -> 45864k
    GGC runs: 276 -> 275

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 111632k
    Peak memory use before GGC: 98589k
    Peak memory use after GGC: 85002k
    Maximum of released memory in single GGC run: 32270k -> 32269k
    Garbage: 352518k -> 352491k
    Leak: 10062k -> 10061k
    Overhead: 46068k -> 46066k
    GGC runs: 281

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 118252k
    Peak memory use before GGC: 95028k
    Peak memory use after GGC: 94080k
    Maximum of released memory in single GGC run: 20299k
    Garbage: 223449k
    Leak: 49470k
    Overhead: 37085k
    GGC runs: 369

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 108460k
    Peak memory use before GGC: 95143k
    Peak memory use after GGC: 93152k
    Maximum of released memory in single GGC run: 20158k
    Garbage: 561222k -> 560919k
    Leak: 52213k
    Overhead: 63020k -> 63006k
    GGC runs: 532

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Ovarall memory allocated via mmap and sbrk decreased from 113144k to 108824k, overall -3.97%
  Amount of produced GGC garbage decreased from 777487k to 683963k, overall -13.67%
    Overall memory needed: 113144k -> 108824k
    Peak memory use before GGC: 95144k
    Peak memory use after GGC: 93152k
    Maximum of released memory in single GGC run: 20158k
    Garbage: 777487k -> 683963k
    Leak: 53309k -> 53294k
    Overhead: 83772k -> 76035k
    GGC runs: 612 -> 619

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage decreased from 857251k to 750497k, overall -14.22%
    Overall memory needed: 112648k -> 110792k
    Peak memory use before GGC: 96537k
    Peak memory use after GGC: 94580k
    Maximum of released memory in single GGC run: 20582k
    Garbage: 857251k -> 750497k
    Leak: 54248k -> 54233k
    Overhead: 89341k -> 80868k
    GGC runs: 625 -> 634

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2006-02-20 03:59:33.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2006-02-20 17:08:14.000000000 +0000
@@ -1,3 +1,71 @@
+2006-02-20  Roger Sayle  <roger@eyesopen.com>
+
+	PR middle-end/26236
+	* doc/c-tree.texi (INTEGER_TYPE): Remove reference to the now
+	deprecated CHAR_TYPE tree code.
+
+2006-02-20  Paolo Bonzini  <bonzini@gnu.org>
+
+	* configure.ac (target_list): Add install-info, dvi, html.
+	* configure: Regenerate.
+
+	* ada/Make-lang.in, cp/Make-lang.in, fortran/Make-lang.in,
+	java/Make-lang.in, objc/Make-lang.in, objcp/Make-lang.in,
+	treelang/Make-lang.in: Do not use double-colon rules.
+
+2006-02-20  Daniel Berlin  <dberlin@dberlin.org>
+
+	* tree.h (struct tree_memory_tag): Add is_used_alone member.
+	(TMT_USED_ALONE): New macro.
+	* tree-pass.h (PROP_tmt_usage): New property.
+	(TODO_update_tmt_usage): New todo.
+	* tree-ssa-alias.c (updating_used_alone): New variable.
+	(recalculate_used_alone): New function.	  
+	(compute_may_aliases): Set updating_used_alone, call
+	recalculate_used_alone. 
+	* tree-sra.c (pass_sra): Note that this pass destroys
+	PROP_tmt_usage, and add TODO_update_tmt_usage.
+	* tree-ssa-forwprop.c (pass_forwprop): Ditto.
+	* tree-flow.h (updating_used_alone): Prototype.
+	(recalculate_used_alone): Ditto.
+	* passes.c (execute_todo): Add code to set updating_used_alone,
+	and call recalculate.
+	* tree-ssa-operands.c (add_virtual_operand): Only append bare def
+	for clobber if used alone, and add assert to verify used_alone
+	status.
+	
+2006-02-20  Angel Nunez Mencias  <anunez@de.ibm.com>
+
+	* config/s390/s390.c (legitimize_pic_address): Assertions checking
+	for non tls symbols added.
+	(legitimize_address): Do nothing for PLUS expressions if one of the
+	addends is a tls symbol reference.
+
+2006-02-20  Paolo Bonzini  <bonzini@gnu.org>
+
+	PR bootstrap/25476
+
+	* Makefile.in (LDFLAGS): Define from autoconf substitution.
+
+	* Makefile.in (BOOTSTRAPPING): New.
+	(quickstrap): New definition if BOOTSTRAPPING=yes.
+
+	* Makefile.in (CONFIG_LANGUAGES): Substitute all_selected_languages.
+	* configure.ac: Substitute all_selected_languages with the languages
+	that were configured.  For all the other variables except
+	lang_specs_files, include all the languages in the tree.
+	* configure: Regenerate.
+	
+	* Makefile.in (stmp-fixinc): Copy includes from the prev-gcc directory,
+	if there is one.  Run the commands to run fixincludes in the same
+	subshell.
+
+	* doc/makefile.texi: Document new makefile targets from toplevel bootstrap.
+	* doc/install.texi: Document exact conventions for searching target tools.
+	Document --with-build-time-tools.  Document toplevel bootstrap.  Document
+	something more about building an Ada cross-compiler.  Don't list GNU Make
+	requirements which affect all platforms.
+
 2006-02-19  Roger Sayle  <roger@eyesopen.com>
 
 	PR middle-end/19543


The results can be reproduced by building a compiler with

--enable-gather-detailed-mem-stats targetting x86-64

and compiling preprocessed combine.c or testcase from PR8632 with:

-fmem-report --param=ggc-min-heapsize=1024 --param=ggc-min-expand=1 -Ox -Q

The memory consumption summary appears in the dump after detailed listing
of the places they are allocated in.  Peak memory consumption is actually
computed by looking for maximal value in {GC XXXX -> YYYY} report.

Your testing script.



More information about the Gcc-regression mailing list