A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Wed Oct 18 03:15: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: 24797k
    Peak memory use before GGC: 8929k
    Peak memory use after GGC: 8558k
    Maximum of released memory in single GGC run: 2576k
    Garbage: 34878k
    Leak: 6073k
    Overhead: 4715k
    GGC runs: 294

comparing combine.c compilation at -O1 level:
    Overall memory needed: 36205k
    Peak memory use before GGC: 17000k
    Peak memory use after GGC: 16830k
    Maximum of released memory in single GGC run: 2262k
    Garbage: 53161k
    Leak: 6071k
    Overhead: 5766k
    GGC runs: 368

comparing combine.c compilation at -O2 level:
    Overall memory needed: 26496k
    Peak memory use before GGC: 16998k
    Peak memory use after GGC: 16830k
    Maximum of released memory in single GGC run: 2508k
    Garbage: 71329k
    Leak: 6173k
    Overhead: 8293k
    GGC runs: 430

comparing combine.c compilation at -O3 level:
    Overall memory needed: 25596k
    Peak memory use before GGC: 17890k
    Peak memory use after GGC: 17446k
    Maximum of released memory in single GGC run: 3324k
    Garbage: 98075k
    Leak: 6244k
    Overhead: 11481k
    GGC runs: 479

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 83700k
    Peak memory use before GGC: 68247k
    Peak memory use after GGC: 43913k
    Maximum of released memory in single GGC run: 35708k
    Garbage: 125964k
    Leak: 9117k
    Overhead: 16830k
    GGC runs: 231

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 102532k
    Peak memory use before GGC: 83520k
    Peak memory use after GGC: 77614k
    Maximum of released memory in single GGC run: 31804k
    Garbage: 258206k
    Leak: 8927k
    Overhead: 28448k
    GGC runs: 230

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 105348k
    Peak memory use before GGC: 87453k
    Peak memory use after GGC: 79913k
    Maximum of released memory in single GGC run: 30384k
    Garbage: 303600k
    Leak: 8932k
    Overhead: 35483k
    GGC runs: 256

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 105388k
    Peak memory use before GGC: 87479k
    Peak memory use after GGC: 79939k
    Maximum of released memory in single GGC run: 30566k
    Garbage: 304171k
    Leak: 8935k
    Overhead: 35660k
    GGC runs: 260

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 92431k to 92731k, overall 0.32%
  Peak amount of GGC memory still allocated after garbage collectin increased from 91511k to 91812k, overall 0.33%
  Amount of produced GGC garbage increased from 200369k to 200877k, overall 0.25%
  Amount of memory still referenced at the end of compilation increased from 47216k to 47326k, overall 0.23%
    Overall memory needed: 116268k -> 116568k
    Peak memory use before GGC: 92431k -> 92731k
    Peak memory use after GGC: 91511k -> 91812k
    Maximum of released memory in single GGC run: 19647k -> 19778k
    Garbage: 200369k -> 200877k
    Leak: 47216k -> 47326k
    Overhead: 20458k -> 20503k
    GGC runs: 399

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 97008k to 97570k, overall 0.58%
  Peak amount of GGC memory still allocated after garbage collectin increased from 94816k to 95362k, overall 0.58%
  Amount of produced GGC garbage increased from 429599k to 431094k, overall 0.35%
  Amount of memory still referenced at the end of compilation increased from 48991k to 49442k, overall 0.92%
    Overall memory needed: 115268k -> 115728k
    Peak memory use before GGC: 97008k -> 97570k
    Peak memory use after GGC: 94816k -> 95362k
    Maximum of released memory in single GGC run: 18292k -> 18425k
    Garbage: 429599k -> 431094k
    Leak: 48991k -> 49442k
    Overhead: 31519k -> 31571k
    GGC runs: 538 -> 541

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 97008k to 97572k, overall 0.58%
  Peak amount of GGC memory still allocated after garbage collectin increased from 94816k to 95363k, overall 0.58%
  Amount of produced GGC garbage increased from 495624k to 497036k, overall 0.28%
  Amount of memory still referenced at the end of compilation increased from 49707k to 50152k, overall 0.90%
    Overall memory needed: 115236k -> 115708k
    Peak memory use before GGC: 97008k -> 97572k
    Peak memory use after GGC: 94816k -> 95363k
    Maximum of released memory in single GGC run: 18293k -> 18424k
    Garbage: 495624k -> 497036k
    Leak: 49707k -> 50152k
    Overhead: 39738k -> 39710k
    GGC runs: 607

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Peak amount of GGC memory still allocated after garbage collectin increased from 96101k to 96649k, overall 0.57%
  Amount of produced GGC garbage increased from 513675k to 515322k, overall 0.32%
  Amount of memory still referenced at the end of compilation increased from 49695k to 49764k, overall 0.14%
    Overall memory needed: 116640k -> 115648k
    Peak memory use before GGC: 98452k -> 97616k
    Peak memory use after GGC: 96101k -> 96649k
    Maximum of released memory in single GGC run: 18613k -> 18845k
    Garbage: 513675k -> 515322k
    Leak: 49695k -> 49764k
    Overhead: 40258k -> 40392k
    GGC runs: 618 -> 614

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 134132k
    Peak memory use before GGC: 81623k
    Peak memory use after GGC: 58503k
    Maximum of released memory in single GGC run: 45494k
    Garbage: 143586k
    Leak: 7138k
    Overhead: 25104k
    GGC runs: 87

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 425328k
    Peak memory use before GGC: 203150k
    Peak memory use after GGC: 198928k
    Maximum of released memory in single GGC run: 100796k
    Garbage: 264978k
    Leak: 47191k
    Overhead: 30026k
    GGC runs: 106

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 347924k
    Peak memory use before GGC: 203907k
    Peak memory use after GGC: 199683k
    Maximum of released memory in single GGC run: 107064k
    Garbage: 354478k
    Leak: 47774k
    Overhead: 47627k
    GGC runs: 113

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 536236k
    Peak memory use before GGC: 314598k
    Peak memory use after GGC: 292942k
    Maximum of released memory in single GGC run: 163427k
    Garbage: 487446k
    Leak: 65106k
    Overhead: 58883k
    GGC runs: 100

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2006-10-17 03:15:52.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2006-10-18 01:41:05.000000000 +0000
@@ -1,3 +1,42 @@
+2006-10-17  Lee Millward  <lee.millward@codesourcery.com> 
+
+        PR c++/27952
+        * cp-tree.h (xref_basetypes): Return bool instead of void.
+        * decl.c (xref_basetypes): Adjust definition. Return false
+        if the class bases are invalid.
+        * parser.c (cp_parser_class_head): Check the return value
+        from xref_basetypes.
+	
+2006-10-17  Mark Mitchell  <mark@codesourcery.com>
+
+	PR c++/28261
+	* parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Add
+	comment.
+
+	PR c++/28261
+	* parser.c (cp_lexer_next_token_is_decl_specifier_keyword): New
+	function.
+	(cp_parser_constructor_declarator_p): Use it.
+	(cp_parser_check_type_definition): Return a value indicating
+	whether or not the definition is valid.
+	(cp_parser_enum_specifier): Skip invalid enum definitions.
+
+2006-10-17  Mark Mitchell  <mark@codesourcery.com>
+
+	PR c++/29039
+	* typeck2.c (build_functional_cast): Don't zero-initialize
+	non-PODs; instead, call their constructors.
+	* method.c (synthesize_method): Always build mem-initializers, if
+	we're synthesizing the default constructor.
+
+2006-10-17  Mark Mitchell  <mark@codesourcery.com>
+
+	PR c++/27270
+	* decl.c (reshape_init_class): Move check for designated
+	to ...
+	* parser.c (cp_parser_initializer_list): ... here.
+	* pt.c (tsubst_copy_and_build): Use finish_compound_literal.
+
 2006-10-16  Mark Mitchell  <mark@codesourcery.com>
 
 	PR c++/27270


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