A recent patch decreased GCC's memory consumption.

gcctest@suse.de gcctest@suse.de
Thu Dec 14 20:38: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 empty function compilation at -O0 level:
    Overall memory needed: 18277k
    Peak memory use before GGC: 2235k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 293k
    Garbage: 423k
    Leak: 2273k
    Overhead: 446k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 18293k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1970k
    Maximum of released memory in single GGC run: 293k
    Garbage: 425k
    Leak: 2305k
    Overhead: 450k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 18377k -> 18381k
    Peak memory use before GGC: 2235k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 293k
    Garbage: 427k
    Leak: 2275k
    Overhead: 446k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 18389k -> 18393k
    Peak memory use before GGC: 2236k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 294k
    Garbage: 430k
    Leak: 2275k
    Overhead: 447k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 18389k -> 18393k
    Peak memory use before GGC: 2236k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 294k
    Garbage: 430k
    Leak: 2275k
    Overhead: 447k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 28437k
    Peak memory use before GGC: 9287k
    Peak memory use after GGC: 8804k
    Maximum of released memory in single GGC run: 2641k
    Garbage: 37502k
    Leak: 6455k
    Overhead: 4869k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 30521k
    Peak memory use before GGC: 10834k
    Peak memory use after GGC: 10464k
    Maximum of released memory in single GGC run: 2360k
    Garbage: 38077k
    Leak: 9331k
    Overhead: 5570k
    GGC runs: 272

comparing combine.c compilation at -O1 level:
    Overall memory needed: 29474k
    Peak memory use before GGC: 16979k
    Peak memory use after GGC: 16792k
    Maximum of released memory in single GGC run: 2254k
    Garbage: 55685k
    Leak: 6489k
    Overhead: 10562k
    GGC runs: 360

comparing combine.c compilation at -O2 level:
    Overall memory needed: 29474k
    Peak memory use before GGC: 16988k
    Peak memory use after GGC: 16792k
    Maximum of released memory in single GGC run: 2611k
    Garbage: 71699k
    Leak: 6611k
    Overhead: 12536k
    GGC runs: 413

comparing combine.c compilation at -O3 level:
    Overall memory needed: 29602k
    Peak memory use before GGC: 18226k
    Peak memory use after GGC: 17749k
    Maximum of released memory in single GGC run: 4564k
    Garbage: 106169k
    Leak: 6688k
    Overhead: 17998k
    GGC runs: 463

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 89650k
    Peak memory use before GGC: 71193k
    Peak memory use after GGC: 44699k
    Maximum of released memory in single GGC run: 37868k
    Garbage: 132105k
    Leak: 9518k
    Overhead: 16952k
    GGC runs: 211

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 90826k
    Peak memory use before GGC: 72354k
    Peak memory use after GGC: 45967k
    Maximum of released memory in single GGC run: 37868k
    Garbage: 133512k
    Leak: 10982k
    Overhead: 17347k
    GGC runs: 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 96050k
    Peak memory use before GGC: 73119k
    Peak memory use after GGC: 70764k
    Maximum of released memory in single GGC run: 31671k
    Garbage: 229861k
    Leak: 9343k
    Overhead: 31154k
    GGC runs: 226

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 128386k
    Peak memory use before GGC: 78731k
    Peak memory use after GGC: 76200k
    Maximum of released memory in single GGC run: 30216k
    Garbage: 282674k
    Leak: 9345k
    Overhead: 37707k
    GGC runs: 247

comparing insn-attrtab.c compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 128162k to 118790k, overall -7.89%
    Overall memory needed: 128162k -> 118790k
    Peak memory use before GGC: 78756k
    Peak memory use after GGC: 76226k
    Maximum of released memory in single GGC run: 30410k
    Garbage: 283518k
    Leak: 9350k
    Overhead: 37940k
    GGC runs: 253

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 119066k
    Peak memory use before GGC: 92331k
    Peak memory use after GGC: 91417k
    Maximum of released memory in single GGC run: 19252k
    Garbage: 210224k
    Leak: 48133k
    Overhead: 20979k
    GGC runs: 413

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 131642k
    Peak memory use before GGC: 104696k
    Peak memory use after GGC: 103652k
    Maximum of released memory in single GGC run: 18947k
    Garbage: 216791k
    Leak: 71564k
    Overhead: 26883k
    GGC runs: 384

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 120074k
    Peak memory use before GGC: 96747k
    Peak memory use after GGC: 94461k
    Maximum of released memory in single GGC run: 17941k
    Garbage: 442053k
    Leak: 50198k
    Overhead: 107726k
    GGC runs: 565

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 120134k
    Peak memory use before GGC: 96775k
    Peak memory use after GGC: 94489k
    Maximum of released memory in single GGC run: 18082k
    Garbage: 497118k
    Leak: 51167k
    Overhead: 63569k
    GGC runs: 621

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 121934k
    Peak memory use before GGC: 97763k
    Peak memory use after GGC: 96142k
    Maximum of released memory in single GGC run: 18476k
    Garbage: 517485k
    Leak: 51140k
    Overhead: 63491k
    GGC runs: 625

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 137646k -> 137302k
    Peak memory use before GGC: 81587k
    Peak memory use after GGC: 58467k
    Maximum of released memory in single GGC run: 45167k
    Garbage: 148513k
    Leak: 7542k
    Overhead: 25327k
    GGC runs: 82

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 138014k
    Peak memory use before GGC: 82233k
    Peak memory use after GGC: 59113k
    Maximum of released memory in single GGC run: 45232k
    Garbage: 148724k
    Leak: 9309k
    Overhead: 25823k
    GGC runs: 88

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 426618k -> 428682k
    Peak memory use before GGC: 205546k
    Peak memory use after GGC: 199777k
    Maximum of released memory in single GGC run: 99746k
    Garbage: 283522k
    Leak: 29778k
    Overhead: 36217k
    GGC runs: 97

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 355578k
    Peak memory use before GGC: 205539k
    Peak memory use after GGC: 199770k
    Maximum of released memory in single GGC run: 96117k
    Garbage: 364129k
    Leak: 30361k
    Overhead: 51967k
    GGC runs: 105

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 769722k -> 769814k
    Peak memory use before GGC: 326891k
    Peak memory use after GGC: 304533k
    Maximum of released memory in single GGC run: 168269k
    Garbage: 504162k
    Leak: 45414k
    Overhead: 66989k
    GGC runs: 97

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2006-12-14 02:18:19.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2006-12-14 18:37:12.000000000 +0000
@@ -1,3 +1,52 @@
+2006-12-14  Jan Hubicka  <jh@suse.cz>
+
+	* tree-flow.h (struct stmt_ann_d): Move bitfield references_memory
+	to proper place.
+
+2006-12-14  Richard Guenther  <rguenther@suse.de>
+
+	PR tree-optimization/30197
+	* builtins.c (fold_builtin_cexp): New function to fold cexp
+	to cexpi and exp parts.
+	* tree-ssa-pre.c (try_combine_conversion): Also handle
+	REALPART_EXPR and IMAGPART_EXPR.
+
+2006-12-14  Richard Guenther  <rguenther@suse.de>
+
+	PR middle-end/30172
+	* fold-const.c (fold_binary): Fold __complex__ ( x, 0 )
+	+ __complex__ ( 0, y ) to __complex__ ( x, y ).
+	Fold __complex__ (x, y) * +-I to __complex__ (-+y, +-x).
+
+2006-12-14  Richard Guenther  <rguenther@suse.de>
+
+	PR tree-optimization/30198
+	* fold-const.c (fold_unary): Fold REALPART_EXPR of cexpi to cos.
+	Fold IMAGPART_EXPR of cexpi to sin.
+
+2006-12-14  Dorit Nuzman  <dorit@il.ibm.com>
+	    Trevor Smigiel  <trevor_smigiel@playstation.sony.com>
+
+	* spu.c (TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD): Defined.
+	(spu_init_builtins): Mark the SPU_MASK_FOR_LOAD builtin decl as read 
+	only.   
+	(spu_expand_builtin_1): Handle the SPU_MASK_FOR_LOAD builtin.
+	(spu_builtin_mask_for_load): New.
+	* spu-builtins.def (SPU_MASK_FOR_LOAD): Define new builtin.
+	* spu.md (UNSPEC_SPU_REALIGN_LOAD, UNSPEC_SPU_MASK_FOR_LOAD):New.
+	(vec_realign_load_<mode>, spu_lvsr): New.
+
+2006-12-13  Ian Lance Taylor  <iant@google.com>
+
+	PR c++/19564
+	PR c++/19756
+	* c-typeck.c (parser_build_binary_op): Move parentheses warnings
+	to warn_about_parentheses in c-common.c.
+	* c-common.c (warn_about_parentheses): New function.
+	* c-common.h (warn_about_parentheses): Declare.
+	* doc/invoke.texi (Warning Options): Update -Wparentheses
+	description.
+
 2006-12-13  Zdenek Dvorak <dvorakz@suse.cz>
 
 	* tree-ssa-loop-ivopts.c: Include tree-affine.h.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2006-12-12 11:12:04.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2006-12-14 18:37:11.000000000 +0000
@@ -1,3 +1,19 @@
+2006-12-13  Ian Lance Taylor  <iant@google.com>
+
+	PR c++/19564
+	PR c++/19756
+	* parser.c (cp_parser_expression_stack_entry): Add field
+	lhs_type.
+	(cp_parser_binary_expression): Track tree code of left hand side
+	of expression.  Use it when calling build_x_binary_op.
+	(cp_parser_selection_statement): Add if_p parameter.  Change all
+	callers.  Warn about ambiguous else.
+	(cp_parser_statement): Add if_p parameter.  Change all callers.
+	(cp_parser_implicitly_scoped_statement): Likewise.
+	* typeck.c (build_x_binary_op): Add parameters arg1_code and
+	arg2_code.  Change all callers.  Call warn_about_parentheses.
+	* cp-tree.h (build_x_binary_op): Update declaration.
+
 2006-12-12  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
 	* decl.c (build_enumerator): Update error message to match C


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