A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Tue Apr 10 00:57: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: 7387k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1952k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2285k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7403k
    Peak memory use before GGC: 2290k
    Peak memory use after GGC: 1979k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2318k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7519k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1952k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2288k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7527k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1952k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2288k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7527k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1952k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2288k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17731k
    Peak memory use before GGC: 9264k
    Peak memory use after GGC: 8851k
    Maximum of released memory in single GGC run: 2578k
    Garbage: 37095k
    Leak: 6580k
    Overhead: 5053k
    GGC runs: 282

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19875k
    Peak memory use before GGC: 10880k
    Peak memory use after GGC: 10511k
    Maximum of released memory in single GGC run: 2352k
    Garbage: 37692k
    Leak: 9473k
    Overhead: 5759k
    GGC runs: 270

comparing combine.c compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 19319k to 19348k, overall 0.15%
  Peak amount of GGC memory still allocated after garbage collecting increased from 19127k to 19155k, overall 0.15%
    Overall memory needed: 35263k -> 35279k
    Peak memory use before GGC: 19319k -> 19348k
    Peak memory use after GGC: 19127k -> 19155k
    Maximum of released memory in single GGC run: 2181k
    Garbage: 56027k -> 56032k
    Leak: 6609k
    Overhead: 6253k -> 6257k
    GGC runs: 353

comparing combine.c compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 19381k to 19415k, overall 0.18%
  Peak amount of GGC memory still allocated after garbage collecting increased from 19179k to 19213k, overall 0.18%
    Overall memory needed: 38331k -> 38343k
    Peak memory use before GGC: 19381k -> 19415k
    Peak memory use after GGC: 19179k -> 19213k
    Maximum of released memory in single GGC run: 2151k
    Garbage: 68085k -> 68117k
    Leak: 6732k -> 6733k
    Overhead: 8082k -> 8090k
    GGC runs: 401 -> 399

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 19483k to 19612k, overall 0.66%
  Peak amount of GGC memory still allocated after garbage collecting increased from 19266k to 19300k, overall 0.18%
  Amount of produced GGC garbage increased from 89211k to 89344k, overall 0.15%
    Overall memory needed: 42671k -> 42643k
    Peak memory use before GGC: 19483k -> 19612k
    Peak memory use after GGC: 19266k -> 19300k
    Maximum of released memory in single GGC run: 3635k -> 3636k
    Garbage: 89211k -> 89344k
    Leak: 6843k -> 6836k
    Overhead: 11059k -> 11073k
    GGC runs: 424 -> 423

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 100527k -> 100531k
    Peak memory use before GGC: 68627k
    Peak memory use after GGC: 44730k
    Maximum of released memory in single GGC run: 36429k
    Garbage: 130923k
    Leak: 9583k
    Overhead: 16927k
    GGC runs: 212

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104223k -> 104355k
    Peak memory use before GGC: 69788k
    Peak memory use after GGC: 45998k
    Maximum of released memory in single GGC run: 36429k
    Garbage: 132399k
    Leak: 11067k
    Overhead: 17324k
    GGC runs: 210

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 145599k -> 145595k
    Peak memory use before GGC: 85948k
    Peak memory use after GGC: 80070k
    Maximum of released memory in single GGC run: 32839k
    Garbage: 264605k
    Leak: 9403k
    Overhead: 27652k
    GGC runs: 226

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 200083k -> 200087k
    Peak memory use before GGC: 87235k
    Peak memory use after GGC: 80140k
    Maximum of released memory in single GGC run: 30044k
    Garbage: 300011k
    Leak: 9401k
    Overhead: 33248k
    GGC runs: 243

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 202203k -> 202223k
    Peak memory use before GGC: 87249k
    Peak memory use after GGC: 80154k
    Maximum of released memory in single GGC run: 30105k
    Garbage: 300678k
    Leak: 9405k
    Overhead: 33451k
    GGC runs: 244

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147073k
    Peak memory use before GGC: 90246k
    Peak memory use after GGC: 89353k
    Maximum of released memory in single GGC run: 17774k
    Garbage: 207955k
    Leak: 49212k
    Overhead: 23912k
    GGC runs: 409

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 164873k
    Peak memory use before GGC: 102853k
    Peak memory use after GGC: 101834k
    Maximum of released memory in single GGC run: 18129k
    Garbage: 214506k
    Leak: 72527k
    Overhead: 29809k
    GGC runs: 384

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 141862k -> 141922k
    Peak memory use before GGC: 101892k -> 101928k
    Peak memory use after GGC: 100882k -> 100917k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 344326k -> 344337k
    Leak: 50302k -> 50302k
    Overhead: 30459k -> 30468k
    GGC runs: 527

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 143958k -> 143990k
    Peak memory use before GGC: 102509k -> 102595k
    Peak memory use after GGC: 101493k -> 101527k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 375696k -> 375659k
    Leak: 51031k -> 51032k
    Overhead: 34763k -> 34760k
    GGC runs: 565 -> 564

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 146194k -> 146242k
    Peak memory use before GGC: 104319k -> 104355k
    Peak memory use after GGC: 103274k -> 103310k
    Maximum of released memory in single GGC run: 17610k
    Garbage: 394721k -> 394625k
    Leak: 51318k -> 51318k
    Overhead: 36328k -> 36321k
    GGC runs: 572

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244771k
    Peak memory use before GGC: 80963k
    Peak memory use after GGC: 58702k
    Maximum of released memory in single GGC run: 44134k
    Garbage: 142205k
    Leak: 7613k
    Overhead: 24559k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245591k
    Peak memory use before GGC: 81609k
    Peak memory use after GGC: 59348k
    Maximum of released memory in single GGC run: 44123k
    Garbage: 142415k
    Leak: 9381k
    Overhead: 25054k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 244087k -> 244163k
    Peak memory use before GGC: 84282k
    Peak memory use after GGC: 74847k
    Maximum of released memory in single GGC run: 36149k
    Garbage: 221623k
    Leak: 20856k
    Overhead: 30444k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 497627k -> 497719k
    Peak memory use before GGC: 79833k
    Peak memory use after GGC: 74847k
    Maximum of released memory in single GGC run: 33439k
    Garbage: 228654k
    Leak: 20946k
    Overhead: 32525k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1268783k -> 1269307k
    Peak memory use before GGC: 201851k
    Peak memory use after GGC: 190309k
    Maximum of released memory in single GGC run: 80677k
    Garbage: 370228k
    Leak: 46312k
    Overhead: 48627k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-04-09 06:34:14.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-04-09 22:58:33.000000000 +0000
@@ -1,3 +1,28 @@
+2007-04-09  Jan Hubicka  <jh@suse.cz>
+
+	* tree-ssa-ccp (maybe_fold_offset_to_component_ref): Recurse into
+	multiple fields of union.
+
+2007-04-09  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* cfgloopmanip.c (create_preheader): Do not use loop_preheader_edge.
+	(create_preheaders): Check that loops are available.
+	(fix_loop_structure): Clean up, improve comments.
+	* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa):
+	Check that loops are available.  Set LOOP_CLOSED_SSA to the loops
+	state flags.
+	* tree-scalar-evolution.c (scev_finalize): Clear scalar_evolution_info.
+	* predict.c (tree_estimate_probability): Do not call
+	calculate_dominance_info.  Call create_preheaders.
+	* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Only call
+	rewrite_into_loop_closed_ssa if LOOP_CLOSED_SSA is set in loops state
+	flags.
+	* cfgloop.c (loop_preheader_edge): Assert that loops have preheaders.
+	* cfgloop.h (LOOP_CLOSED_SSA): New constant.
+	* tree-cfg.c (tree_split_edge): Make an assert more precise.
+	* tree-ssa-threadedge.c (thread_across_edge): Comment the function
+	arguments.
+
 2007-04-08  Jan Hubicka  <jh@suse.cz>
 
 	* tree.h (maybe_fold_offset_to_component_ref): Declare.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-04-08 14:01:19.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-04-09 22:58:33.000000000 +0000
@@ -1,3 +1,13 @@
+2007-04-09  Mark Mitchell  <mark@codesourcery.com>
+
+	PR c++/31449
+	* class.c (build_base_path): Ensure that the converted pointer has
+	the same cv-qualification as the input.
+
+2007-04-09  Paolo Carlini  <pcarlini@suse.de>
+
+	* tree.c (cp_tree_equal): Deal with TRAIT_EXPR.
+
 2007-04-08  Steven Bosscher  <steven@gcc.gnu.org>
 
 	* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS):


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