A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Fri Jan 5 05:07:00 GMT 2007


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: 18333k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 444k
    Leak: 2287k
    Overhead: 455k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 18349k
    Peak memory use before GGC: 2291k
    Peak memory use after GGC: 1981k
    Maximum of released memory in single GGC run: 310k
    Garbage: 447k
    Leak: 2320k
    Overhead: 460k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 18445k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 450k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 18457k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 453k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 18457k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 453k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 28613k
    Peak memory use before GGC: 9312k
    Peak memory use after GGC: 8864k
    Maximum of released memory in single GGC run: 2606k
    Garbage: 37286k -> 37291k
    Leak: 6539k
    Overhead: 4828k -> 4829k
    GGC runs: 276

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 30665k
    Peak memory use before GGC: 10895k
    Peak memory use after GGC: 10524k
    Maximum of released memory in single GGC run: 2366k
    Garbage: 37877k
    Leak: 9414k
    Overhead: 5530k
    GGC runs: 271

comparing combine.c compilation at -O1 level:
    Overall memory needed: 33538k
    Peak memory use before GGC: 20886k
    Peak memory use after GGC: 20677k
    Maximum of released memory in single GGC run: 2262k
    Garbage: 55524k -> 55524k
    Leak: 6566k
    Overhead: 9977k
    GGC runs: 350 -> 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 33538k
    Peak memory use before GGC: 20907k
    Peak memory use after GGC: 20700k
    Maximum of released memory in single GGC run: 2202k
    Garbage: 71550k -> 71538k
    Leak: 6695k
    Overhead: 11898k -> 11897k
    GGC runs: 406 -> 408

comparing combine.c compilation at -O3 level:
    Overall memory needed: 32766k
    Peak memory use before GGC: 21970k
    Peak memory use after GGC: 21365k
    Maximum of released memory in single GGC run: 3136k
    Garbage: 104785k -> 104670k
    Leak: 6769k -> 6769k
    Overhead: 16614k -> 16598k
    GGC runs: 455 -> 464

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 89194k
    Peak memory use before GGC: 70731k
    Peak memory use after GGC: 44749k
    Maximum of released memory in single GGC run: 37355k
    Garbage: 131554k
    Leak: 9580k
    Overhead: 16626k
    GGC runs: 208 -> 210

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 90370k
    Peak memory use before GGC: 71893k
    Peak memory use after GGC: 46017k
    Maximum of released memory in single GGC run: 37357k
    Garbage: 132716k
    Leak: 11269k
    Overhead: 17020k
    GGC runs: 207 -> 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 100974k
    Peak memory use before GGC: 76174k
    Peak memory use after GGC: 72306k
    Maximum of released memory in single GGC run: 31284k
    Garbage: 229283k
    Leak: 9405k
    Overhead: 29492k
    GGC runs: 219

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 112634k
    Peak memory use before GGC: 83860k
    Peak memory use after GGC: 78025k
    Maximum of released memory in single GGC run: 29572k
    Garbage: 281116k
    Leak: 9402k
    Overhead: 35350k
    GGC runs: 241

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 112662k
    Peak memory use before GGC: 83901k
    Peak memory use after GGC: 78065k
    Maximum of released memory in single GGC run: 29760k
    Garbage: 281946k
    Leak: 9407k
    Overhead: 35580k
    GGC runs: 242

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 119830k
    Peak memory use before GGC: 93043k
    Peak memory use after GGC: 92120k
    Maximum of released memory in single GGC run: 18912k
    Garbage: 208226k -> 208232k
    Leak: 49015k
    Overhead: 21200k -> 21200k
    GGC runs: 408 -> 409

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 132298k
    Peak memory use before GGC: 105318k
    Peak memory use after GGC: 104273k
    Maximum of released memory in single GGC run: 18749k
    Garbage: 214805k -> 214816k
    Leak: 72446k -> 72442k
    Overhead: 27104k -> 27105k
    GGC runs: 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of produced GGC garbage increased from 437562k to 438044k, overall 0.11%
    Overall memory needed: 139606k
    Peak memory use before GGC: 112869k
    Peak memory use after GGC: 111747k
    Maximum of released memory in single GGC run: 17925k
    Garbage: 437562k -> 438044k
    Leak: 51042k -> 51043k
    Overhead: 99303k -> 99345k
    GGC runs: 557 -> 587

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 139650k
    Peak memory use before GGC: 112895k
    Peak memory use after GGC: 111773k
    Maximum of released memory in single GGC run: 17925k
    Garbage: 492118k -> 492374k
    Leak: 52005k
    Overhead: 58659k -> 58677k
    GGC runs: 596 -> 633

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 141526k
    Peak memory use before GGC: 114685k
    Peak memory use after GGC: 113482k
    Maximum of released memory in single GGC run: 18326k
    Garbage: 512683k -> 512902k
    Leak: 51977k
    Overhead: 58603k -> 58612k
    GGC runs: 603 -> 645

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 137274k -> 137646k
    Peak memory use before GGC: 81607k
    Peak memory use after GGC: 58487k
    Maximum of released memory in single GGC run: 44559k
    Garbage: 148154k
    Leak: 8080k
    Overhead: 25066k
    GGC runs: 80 -> 81

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 137658k -> 138198k
    Peak memory use before GGC: 82253k
    Peak memory use after GGC: 59132k
    Maximum of released memory in single GGC run: 44207k
    Garbage: 148372k
    Leak: 9335k
    Overhead: 25561k
    GGC runs: 88 -> 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 421926k -> 418342k
    Peak memory use before GGC: 200815k
    Peak memory use after GGC: 194628k
    Maximum of released memory in single GGC run: 112450k
    Garbage: 282084k
    Leak: 29804k
    Overhead: 31999k
    GGC runs: 91 -> 92

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 341726k -> 341930k
    Peak memory use before GGC: 200810k
    Peak memory use after GGC: 194623k
    Maximum of released memory in single GGC run: 111878k
    Garbage: 359138k
    Leak: 30387k
    Overhead: 47155k
    GGC runs: 100 -> 101

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 923074k -> 923434k
    Peak memory use before GGC: 317277k
    Peak memory use after GGC: 295752k
    Maximum of released memory in single GGC run: 168455k
    Garbage: 494906k
    Leak: 45440k
    Overhead: 59089k
    GGC runs: 96 -> 97

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-01-04 15:35:26.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-01-05 03:20:03.000000000 +0000
@@ -1,5 +1,49 @@
 2007-01-04  Jan Hubicka  <jh@suse.cz>
 
+	* tree-optimize.c (execute_fixup_cfg): Correct previously mistakely
+	comitted older version of patch.
+	(pass_fixup_cfg): Add TODOs to verify flow and statements, dump
+	function, celanup cfg and collect garbage.
+
+2007-01-04  Mike Stump  <mrs@apple.com>
+
+	* Makefile.in (mostlyclean): Don't remove libgcc anymore.
+	(clean): Likewise.
+
+2007-01-04  Eric Christopher  <echristo@apple.com>
+
+	* libgcc2.c (__bswapsi2): Use SItype.
+	(__bswapdi2): Use DItype.
+	* libgcc2.h: Update for above.
+
+2007-01-04  Paul Brook  <paul@codesourcery.com>
+
+	* config/arm/arm.md (arm_mulsi3, thumb_mulsi3, mulsi3_compare0,
+	mulsi_compare0_scratch, mulsi3addsi, mulsi3addsi_compare0,
+	mulsi3addsi_compare0_scratch, mulsidi3adddi, mulsidi3,
+	umulsidi3, umulsidi3adddi, smulsi3_highpart,
+	umulsi3_highpart): Make conditional on !arm_arch6.
+	(arm_mulsi3_v6, thumb_mulsi3_v6, mulsi3_compare0_v6,
+	mulsi_compare0_scratch_v6, mulsi3addsi_v6, mulsi3addsi_compare0_v6,
+	mulsi3addsi_compare0_scratch_v6, mulsidi3adddi_v6, mulsidi3_v6,
+	umulsidi3_v6, umulsidi3adddi_v6, smulsi3_highpart_v6,
+	umulsi3_highpart_v6): New insns.
+
+2007-01-04  Roger Sayle  <roger@eyesopen.com>
+
+	* fold-const.c (fold_convert): When casting an expression to void,
+	fold_ignored_result may discover a GIMPLE_MODIFY_STMT which doesn't
+	have a type.  Instead of attempting to build a NOP_EXPR, return
+	these "special" trees directly.
+
+2007-01-04  Joseph Myers  <joseph@codesourcery.com>
+
+	* config/rs6000/rs6000.c (rs6000_rtx_costs): Make adjustment for
+	MULT inside MINUS as either argument.  Use rs6000_cost->dmul -
+	rs6000_cost->fp not 0 as adjustment for outer NEG.
+
+2007-01-04  Jan Hubicka  <jh@suse.cz>
+
 	* cgraph.c (cgraph_release_function_body): New function.
 	(cgraph_remove_node): Use it.
 	* cgraph.h (cgraph_release_function_body): Declare.
@@ -355,14 +399,14 @@
 2007-01-02  Steve Ellcey  <sje@cup.hp.com>
 
 	* sbitmap.c (HOST_BITS_PER_LONG_LONG):  Change to
-	HOST_BITS_PER_LONGLONG 
+	HOST_BITS_PER_LONGLONG
 
 2007-01-02  Manuel Lopez-Ibanez <manu@gcc.gnu.org>
 
 	PR c/19977
 	* c-typeck.c (store_init_value): Don't emit pedantic overflow
 	warning for non-static initializers.
-	
+
 2007-01-02  Steven Bosscher  <steven@gcc.gnu.org>
 
 	* config/alpha/alpha.md, arm/arm.c, darwin.c, frv/frv.md,
@@ -401,7 +445,7 @@
 	* c-opts.c (c_common_post_options): Enabled by -Wextra.
 	* c-decl.c (declspecs_add_scspec): Replace -Wextra with
 	-Wold-style-declaration.
-	
+
 2007-01-02  Kazu Hirata  <kazu@codesourcery.com>
 
 	* alias.c (init_alias_analysis): Use VEC_safe_grow_cleared.
@@ -419,7 +463,7 @@
 
 	* c-common.c(c_common_nodes_and_builtins): Since variants of
 	void_type_node get built before it is given a name, we need to
-	give those variants the name, too. 
+	give those variants the name, too.
 	(complete_array_type): We need to work with the canonical main
 	type of the array, from which we will build the qualified version.
 	* params.def (PARAM_VERIFY_CANONICAL_TYPES): New.
@@ -449,7 +493,7 @@
 	structural equality tests.
 	(build_array_type): Build the canonical form of an array type.
 	(build_function_type): Function types require structural equality,
-	because they contain default arguments, attributes, etc. 
+	because they contain default arguments, attributes, etc.
 	(build_method_type_directly): Ditto for method types.
 	(build_offset_type): Build the canonical offset type.
 	(build_complex_type): Build the canonical vector type.


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