A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Fri Sep 14 08:44: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: 7043k
    Peak memory use before GGC: 1166k
    Peak memory use after GGC: 1062k
    Maximum of released memory in single GGC run: 121k
    Garbage: 249k
    Leak: 1077k
    Overhead: 148k
    GGC runs: 4

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7059k
    Peak memory use before GGC: 1193k
    Peak memory use after GGC: 1089k
    Maximum of released memory in single GGC run: 124k
    Garbage: 251k
    Leak: 1110k
    Overhead: 152k
    GGC runs: 4

comparing empty function compilation at -O1 level:
    Overall memory needed: 7095k
    Peak memory use before GGC: 1166k
    Peak memory use after GGC: 1054k
    Maximum of released memory in single GGC run: 117k
    Garbage: 251k
    Leak: 1078k
    Overhead: 148k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 7099k
    Peak memory use before GGC: 1166k
    Peak memory use after GGC: 1054k
    Maximum of released memory in single GGC run: 116k
    Garbage: 255k
    Leak: 1079k
    Overhead: 149k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 7099k
    Peak memory use before GGC: 1166k
    Peak memory use after GGC: 1054k
    Maximum of released memory in single GGC run: 116k
    Garbage: 255k
    Leak: 1079k
    Overhead: 149k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 22047k
    Peak memory use before GGC: 8292k
    Peak memory use after GGC: 7632k
    Maximum of released memory in single GGC run: 1581k
    Garbage: 38805k
    Leak: 6210k
    Overhead: 5052k
    GGC runs: 372

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 24059k -> 24055k
    Peak memory use before GGC: 10122k
    Peak memory use after GGC: 9396k
    Maximum of released memory in single GGC run: 1874k
    Garbage: 39156k
    Leak: 9037k
    Overhead: 5724k
    GGC runs: 344

comparing combine.c compilation at -O1 level:
    Overall memory needed: 33131k -> 33127k
    Peak memory use before GGC: 17067k
    Peak memory use after GGC: 16879k
    Maximum of released memory in single GGC run: 1379k
    Garbage: 52438k
    Leak: 6357k
    Overhead: 6033k
    GGC runs: 442

comparing combine.c compilation at -O2 level:
    Overall memory needed: 35383k -> 35387k
    Peak memory use before GGC: 17137k
    Peak memory use after GGC: 16967k
    Maximum of released memory in single GGC run: 1336k
    Garbage: 71317k
    Leak: 6675k
    Overhead: 8284k
    GGC runs: 510

comparing combine.c compilation at -O3 level:
    Overall memory needed: 39871k
    Peak memory use before GGC: 17366k
    Peak memory use after GGC: 17021k
    Maximum of released memory in single GGC run: 2131k
    Garbage: 92695k
    Leak: 6802k
    Overhead: 10764k
    GGC runs: 540

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 138499k
    Peak memory use before GGC: 58646k
    Peak memory use after GGC: 32139k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 131583k
    Leak: 8939k
    Overhead: 14856k
    GGC runs: 296

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 139751k
    Peak memory use before GGC: 59795k
    Peak memory use after GGC: 33288k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 132068k
    Leak: 10375k
    Overhead: 15237k
    GGC runs: 290

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 149711k -> 149715k
    Peak memory use before GGC: 57143k
    Peak memory use after GGC: 50913k
    Maximum of released memory in single GGC run: 24232k
    Garbage: 212484k
    Leak: 9832k
    Overhead: 24861k
    GGC runs: 320

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 187251k -> 187259k
    Peak memory use before GGC: 57777k
    Peak memory use after GGC: 52503k
    Maximum of released memory in single GGC run: 22973k
    Garbage: 253944k
    Leak: 10919k
    Overhead: 30607k
    GGC runs: 351

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 194487k
    Peak memory use before GGC: 69771k
    Peak memory use after GGC: 63204k
    Maximum of released memory in single GGC run: 23359k
    Garbage: 280710k
    Leak: 10925k
    Overhead: 32373k
    GGC runs: 351

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 155186k -> 155196k
    Peak memory use before GGC: 89694k
    Peak memory use after GGC: 88801k
    Maximum of released memory in single GGC run: 18062k
    Garbage: 210317k
    Leak: 52988k
    Overhead: 26476k
    GGC runs: 418

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 175770k -> 174556k
    Peak memory use before GGC: 101998k -> 101137k
    Peak memory use after GGC: 100988k -> 100135k
    Maximum of released memory in single GGC run: 18268k -> 18248k
    Garbage: 216162k -> 215905k
    Leak: 75856k -> 74812k
    Overhead: 32156k -> 31885k
    GGC runs: 386 -> 392

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 121559k -> 121560k
    Peak memory use before GGC: 88593k
    Peak memory use after GGC: 87716k
    Maximum of released memory in single GGC run: 17329k
    Garbage: 297854k -> 297852k
    Leak: 52244k
    Overhead: 30854k -> 30854k
    GGC runs: 517

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 127211k -> 127212k
    Peak memory use before GGC: 88773k
    Peak memory use after GGC: 87886k
    Maximum of released memory in single GGC run: 17313k
    Garbage: 365039k -> 365038k
    Leak: 53323k
    Overhead: 38074k -> 38073k
    GGC runs: 594

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 131111k -> 131108k
    Peak memory use before GGC: 89879k
    Peak memory use after GGC: 88984k
    Maximum of released memory in single GGC run: 17671k
    Garbage: 392050k -> 392049k
    Leak: 53574k
    Overhead: 40464k -> 40464k
    GGC runs: 610

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 379373k
    Peak memory use before GGC: 101495k
    Peak memory use after GGC: 57149k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179457k
    Leak: 6297k
    Overhead: 30887k
    GGC runs: 107

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 380189k
    Peak memory use before GGC: 102129k
    Peak memory use after GGC: 57782k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179561k
    Leak: 8005k
    Overhead: 31352k
    GGC runs: 111

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Amount of produced GGC garbage increased from 235786k to 236023k, overall 0.10%
    Overall memory needed: 295503k -> 296755k
    Peak memory use before GGC: 80804k
    Peak memory use after GGC: 73190k
    Maximum of released memory in single GGC run: 40019k
    Garbage: 235786k -> 236023k
    Leak: 15636k
    Overhead: 32055k -> 31660k
    GGC runs: 105

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 270059k -> 270375k
    Peak memory use before GGC: 78176k
    Peak memory use after GGC: 73190k
    Maximum of released memory in single GGC run: 33751k
    Garbage: 245825k -> 246062k
    Leak: 15725k
    Overhead: 34280k -> 33727k
    GGC runs: 118

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1017635k -> 1017567k
    Peak memory use before GGC: 166818k
    Peak memory use after GGC: 156382k
    Maximum of released memory in single GGC run: 83494k
    Garbage: 357355k
    Leak: 25867k
    Overhead: 46232k
    GGC runs: 99

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-09-13 14:05:54.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-09-14 06:26:26.000000000 +0000
@@ -1,3 +1,86 @@
+2007-09-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+	* config/spu/vmx2spu.h (vec_extract, vec_insert, vec_lvlx,
+	vec_lvlxl, vec_lvrx, vec_lvrxl, vec_promote, vec_splats,
+	vec_stvlx, vec_stvlxl, vec_stvrx, vec_stvrxl): New intrinsics.
+
+2007-09-13  Eric Christopher  <echristo@apple.com>
+	    Kenneth Zadeck <zadeck@naturalbridge.com>
+
+	* dse.c (find_shift_sequence): New function.
+	(replace_read): Add case to remove read if it requires shift.
+	* config/i386/i386.c (ix86_expand_prologue): Fixed typo in comment.
+	
+2007-09-13  Tom Tromey  <tromey@redhat.com>
+
+	* c-common.c (fname_as_string): Update.
+	* c-parser.c (c_parser) <lex_untranslated_string>: New field.
+	(c_lex_one_token): Update.  Add 'parser' argument.
+	(c_parser_simple_asm_expr): Update.
+	(c_parser_attributes): Update.
+	(c_parser_asm_statement): Update.
+	(c_parser_asm_operands): Update.
+	(c_parser_peek_token): Update.
+	(c_parser_peek_2nd_token): Update.
+	* c-lex.c (c_lex_string_translate): Remove.
+	(c_lex_return_raw_strings): Likewise.
+	(c_lex_with_flags): Added 'lex_flags' argument.
+	(lex_string): Added 'translate' argument.
+	* c-pragma.h (c_lex_with_flags): Update.
+	(c_lex_string_translate, c_lex_return_raw_strings): Remove.
+	(C_LEX_STRING_NO_TRANSLATE): New define.
+	(C_LEX_RAW_STRINGS): Likewise.
+
+2007-09-13  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	From Jie Zhang:
+	* config/bfin/bfin.c (enum bfin_builtins): Add BFIN_BUILTIN_ONES,
+	BFIN_BUILTIN_CPLX_MUL_16_S40, BFIN_BUILTIN_CPLX_MAC_16_S40,
+	BFIN_BUILTIN_CPLX_MSU_16_S40, and BFIN_BUILTIN_CPLX_SQU.
+	(bfin_init_builtins): Initialize __builtin_bfin_ones,
+	__builtin_bfin_min_fr1x16, __builtin_bfin_max_fr1x16,
+	__builtin_bfin_min_fr1x32, __builtin_bfin_max_fr1x32,
+	__builtin_bfin_cmplx_add, __builtin_bfin_cmplx_sub,
+	__builtin_bfin_cmplx_mul_s40, __builtin_bfin_cmplx_mac_s40,
+	__builtin_bfin_cmplx_msu_s40 and __builtin_bfin_csqu_fr16.
+	(bdesc_1arg): Add __builtin_bfin_ones.
+	(bfin_expand_builtin): Expand __builtin_bfin_cmplx_mul_s40,
+	__builtin_bfin_cmplx_mac_s40, __builtin_bfin_cmplx_msu_s40,
+	and __builtin_bfin_csqu_fr16.
+	* config/bfin/bfin.md (UNSPEC_ONES): New constant.
+	(ones): New define_insn.
+	(ssaddhi3_parts): New define_insn.
+	(sssubhi3_parts): New define_insn.
+	(flag_mulhi_parts): New define_insn.
+
+2007-09-13  Seongbae Park <seongbae.park@gmail.com>
+
+	* common.opt (femit-class-debug-always): Turn off by default.
+
+2007-09-13  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/bfin.md (reload_outpdi, reload_inpdi): New patterns.
+	* config/bfin/bfin.c (bfin_secondary_reload): Make sure we use them.
+
+2007-09-13  James E. Wilson  <wilson@specifix.com>
+
+	PR tree-optimization/33389
+	* tree-ssa-operands.c (append_vuse): If ann->in_vdef_list true,
+	then set build_loads before returning.
+
+2007-09-13  Sandra Loosemore  <sandra@codesourcery.com>
+	    David Ung  <davidu@mips.com>
+
+	* config/mips/mips.h (ASM_OUTPUT_REG_PUSH): Replace {d}subu with
+	{d}addiu and a negative	immediate such that it works with MIPS16
+	instructions.
+	
+2007-09-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bootstrap/33418
+	* configure.ac (ld_vers): Support Linux linker.
+	* configure: Regenerated.
+
 2007-09-13  Richard Sandiford  <richard@codesourcery.com>
 	    Sandra Loosemore <sandra@codesourcery.com>
 
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-09-11 14:16:10.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-09-14 06:26:23.000000000 +0000
@@ -1,3 +1,20 @@
+2007-09-14  Jason Merrill  <jason@redhat.com>
+
+	PR c++/17743, c++/19163
+	* decl2.c (is_late_template_attribute): New fn.
+	(splice_template_attributes, save_template_attributes): New fns.
+	(cplus_decl_attributes): Call save_template_attributes.
+	* pt.c (apply_late_template_attributes): New fn.
+	(instantiate_class_template, tsubst_decl): Use it.
+	* cp-tree.h: Declare is_late_template_attribute.
+
+2007-09-13  Tom Tromey  <tromey@redhat.com>
+
+	* parser.c (cp_lexer_new_main): Don't use
+	c_lex_return_raw_strings.
+	(cp_lexer_get_preprocessor_token): Update.  Add special case when
+	lexer is NULL.
+
 2007-09-11  Jan Hubicka <jh@suse.cz>
 
 	* method.c (use_thunk): Use tree_rest_of_compilation


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