A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Tue Aug 28 06:46: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: 8333k -> 8332k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3043k
    Maximum of released memory in single GGC run: 353k
    Garbage: 525k
    Leak: 3798k
    Overhead: 915k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 8349k -> 8348k
    Peak memory use before GGC: 3423k
    Peak memory use after GGC: 3071k
    Maximum of released memory in single GGC run: 352k
    Garbage: 527k
    Leak: 3831k
    Overhead: 919k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 8385k -> 8384k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3043k
    Maximum of released memory in single GGC run: 353k
    Garbage: 527k
    Leak: 3799k
    Overhead: 915k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 8393k -> 8392k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3044k
    Maximum of released memory in single GGC run: 352k
    Garbage: 531k
    Leak: 3800k
    Overhead: 916k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 8393k -> 8392k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3044k
    Maximum of released memory in single GGC run: 352k
    Garbage: 531k
    Leak: 3800k
    Overhead: 916k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 23753k -> 23752k
    Peak memory use before GGC: 10323k
    Peak memory use after GGC: 9567k
    Maximum of released memory in single GGC run: 1903k
    Garbage: 39067k
    Leak: 8856k
    Overhead: 5786k
    GGC runs: 254

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 25621k -> 25620k
    Peak memory use before GGC: 11984k
    Peak memory use after GGC: 11358k
    Maximum of released memory in single GGC run: 1516k
    Garbage: 39437k
    Leak: 11749k
    Overhead: 6492k
    GGC runs: 250

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35741k -> 35732k
    Peak memory use before GGC: 18984k
    Peak memory use after GGC: 18794k
    Maximum of released memory in single GGC run: 1375k -> 1376k
    Garbage: 52588k -> 52589k
    Leak: 8994k -> 8995k
    Overhead: 6749k -> 6749k
    GGC runs: 321 -> 322

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37749k -> 37752k
    Peak memory use before GGC: 19038k
    Peak memory use after GGC: 18848k
    Maximum of released memory in single GGC run: 1410k -> 1409k
    Garbage: 70990k -> 71026k
    Leak: 9322k -> 9327k
    Overhead: 8864k -> 8867k
    GGC runs: 383

comparing combine.c compilation at -O3 level:
  Amount of memory still referenced at the end of compilation increased from 9434k to 9447k, overall 0.14%
    Overall memory needed: 40557k -> 40596k
    Peak memory use before GGC: 19313k
    Peak memory use after GGC: 18965k
    Maximum of released memory in single GGC run: 2261k
    Garbage: 92929k -> 92926k
    Leak: 9434k -> 9447k
    Overhead: 11492k -> 11493k
    GGC runs: 412

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 140097k -> 140096k
    Peak memory use before GGC: 60580k
    Peak memory use after GGC: 34074k
    Maximum of released memory in single GGC run: 34143k
    Garbage: 132016k
    Leak: 11586k
    Overhead: 15589k
    GGC runs: 197

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 141357k -> 141360k
    Peak memory use before GGC: 61742k
    Peak memory use after GGC: 35235k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 132500k
    Leak: 13040k
    Overhead: 15986k
    GGC runs: 199

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 150225k -> 150232k
    Peak memory use before GGC: 59101k
    Peak memory use after GGC: 52850k
    Maximum of released memory in single GGC run: 24232k
    Garbage: 212962k
    Leak: 12480k
    Overhead: 25582k
    GGC runs: 222

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 188741k -> 188896k
    Peak memory use before GGC: 59723k
    Peak memory use after GGC: 54429k
    Maximum of released memory in single GGC run: 22887k
    Garbage: 254073k
    Leak: 13562k
    Overhead: 31305k
    GGC runs: 249

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 195877k -> 195880k
    Peak memory use before GGC: 71708k
    Peak memory use after GGC: 65141k
    Maximum of released memory in single GGC run: 23330k
    Garbage: 281238k
    Leak: 13573k
    Overhead: 33104k
    GGC runs: 252

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 156868k -> 156888k
    Peak memory use before GGC: 91852k
    Peak memory use after GGC: 90943k
    Maximum of released memory in single GGC run: 18215k
    Garbage: 210833k
    Leak: 55681k
    Overhead: 27340k
    GGC runs: 394

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 177444k
    Peak memory use before GGC: 104643k
    Peak memory use after GGC: 103603k
    Maximum of released memory in single GGC run: 18753k
    Garbage: 216695k
    Leak: 79109k
    Overhead: 33309k
    GGC runs: 373

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of memory still referenced at the end of compilation increased from 55774k to 55831k, overall 0.10%
    Overall memory needed: 135411k -> 135426k
    Peak memory use before GGC: 96347k
    Peak memory use after GGC: 95393k
    Maximum of released memory in single GGC run: 17368k
    Garbage: 319838k -> 319788k
    Leak: 55774k -> 55831k
    Overhead: 33555k -> 33559k
    GGC runs: 497 -> 498

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 145291k -> 145202k
    Peak memory use before GGC: 96177k
    Peak memory use after GGC: 95224k
    Maximum of released memory in single GGC run: 17372k
    Garbage: 379569k -> 379662k
    Leak: 57064k -> 57090k
    Overhead: 39962k -> 39970k
    GGC runs: 560

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 149099k -> 149098k
    Peak memory use before GGC: 97900k
    Peak memory use after GGC: 96816k
    Maximum of released memory in single GGC run: 17747k
    Garbage: 417838k -> 417872k
    Leak: 57365k -> 57387k
    Overhead: 43271k -> 43273k
    GGC runs: 583 -> 582

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 381015k
    Peak memory use before GGC: 103476k
    Peak memory use after GGC: 59130k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179674k
    Leak: 9010k
    Overhead: 31654k
    GGC runs: 65

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 381835k
    Peak memory use before GGC: 104123k
    Peak memory use after GGC: 59776k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179827k
    Leak: 10778k
    Overhead: 32150k
    GGC runs: 72

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 290145k -> 290148k
    Peak memory use before GGC: 82784k
    Peak memory use after GGC: 75172k
    Maximum of released memory in single GGC run: 40017k
    Garbage: 236071k
    Leak: 18348k
    Overhead: 32719k
    GGC runs: 69

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 277889k -> 279592k
    Peak memory use before GGC: 80159k
    Peak memory use after GGC: 75173k
    Maximum of released memory in single GGC run: 33750k
    Garbage: 246134k
    Leak: 18437k
    Overhead: 34945k
    GGC runs: 82

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1012661k -> 1012732k
    Peak memory use before GGC: 168800k
    Peak memory use after GGC: 158364k
    Maximum of released memory in single GGC run: 83495k
    Garbage: 356480k
    Leak: 28512k
    Overhead: 46899k
    GGC runs: 65

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-08-27 12:57:26.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-08-28 04:53:17.000000000 +0000
@@ -1,3 +1,87 @@
+2007-08-27  Alexandre Oliva  <aoliva@redhat.com>
+
+	* doc/extend.texi (gnu_inline funtion attribute): Document C++
+	behavior.
+
+2007-08-27  Jason Merrill  <jason@redhat.com>
+
+	PR c++/31337
+	* gimplify.c (gimplify_modify_expr): Discard the assignment of 
+	zero-sized types after calling gimplify_modify_expr_rhs.
+
+2007-08-27  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* regclass.c (init_reg_autoinc): Fix typo.
+
+2007-08-27  Daniel Berlin  <dberlin@dberlin.org>
+	
+	Fix PR tree-optimization/33173
+	* tree-ssa-alias.c (find_used_portions): Fix reversed test.
+
+2007-08-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR target/31385
+	* config/i386/i386.h (VALID_DFP_MODE_P): New.
+	* config/i386/i386.c (ix86_hard_regno_mode_ok): Allow DFP in
+	GPR.
+
+2007-08-27  Sandra Loosemore  <sandra@codesourcery.com>
+	    David Ung  <davidu@mips.com>
+	    Nigel Stephens <nigel@mips.com>
+
+	Separate target-specific initialization from general
+	back-end initialization.
+
+	* toplev.c (init_alignments): New, split out from...
+	(process_options): ...here.
+	(backend_init_target):  New, split out from...
+	(backend_init): ...here.
+	(lang_dependent_init_target):  New, split out from...
+	(lang_dependent_init): ...here.
+	(target_reinit): New.
+	* toplev.h (target_reinit): Declare.
+	* expr.c (init_expr_target): Renamed from init_expr_once, since it
+	now can be called more than once.  Update comments.
+	* expr.h (init_expr_target): Likewise.
+	* alias.c (init_alias_target): Renamed from init_alias_once, since it
+	now can be called more than once.  Explicitly zero
+	static_reg_base_value.
+	* emit-rtl.c (init_emit_regs): New, split out from...
+	(init_emit_once): Here.
+	* regclass.c (initial_fixed_regs, initial_call_used_regs): Make
+	non-const, so that changes from command-line arguments can overwrite
+	values provided by the static initializers.
+	(initial_call_really_used_regs): New, used similarly to the above.
+	(initial_reg_names): Likewise.
+	(last_mode_for_init_move_cost): Promoted function-local static to
+	file-scope static to make it accessible outside init_move_cost.
+	(init_reg_sets): Do not initialize fixed_regs and call_used_regs yet.
+	Do not initialize inv_reg_alloc_order yet, either.  Do initialize
+	reg_names since it is needed for parsing command-line options.
+	(init_move_cost): Use last_mode_for_init_move_cost instead of
+	function-local static.
+	(init_reg_sets_1): Initialize fixed_regs, call_used_regs, and
+	call_really_used_regs now.  Reinitialize reg_names.  Also
+	initialize inv_reg_alloc_order.  Zero reg_class_subunion and
+	reg_class_superunion.  Clear losing_caller_save_reg_set.
+	Preserve global registers if called more than once.  Reset
+	move cost, may_move_in_cost, may_move_out_cost, and
+	last_mode_for_init_move_cost.
+	(init_reg_modes_target): Renamed from init_reg_modes_once, since it
+	can now be invoked more than once.  Update comments.
+	(init_regs): Update comments.
+	(fix_register): Update initial_fixed_regs, initial_call_used_regs,
+	and initial_call_really_used_regs, instead of the non-initial 
+        variables.  This allows us to save the command-line register settings
+	after target reinitialization.
+	(init_reg_autoinc): Zero forbidden_inc_dec_classes.
+	* rtl.h (init_emit_regs): Declare.
+	(init_reg_modes_target, init_alias_target): Renamed as described
+	above.
+	* reload1.c (init_reload): Update comments.
+	* optabs.c (init_optabs): Likewise.
+	* cfgloopanal.c (init_set_costs): Explicitly zero target_avail_regs.
+	
 2007-08-26  Chao-ying Fu  <fu@mips.com>
 
 	* rtl.h (XCNMPFV): Preserve const-ness of parameters through use of
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-08-26 05:19:42.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-08-28 04:53:16.000000000 +0000
@@ -1,3 +1,11 @@
+2007-08-27  Alexandre Oliva  <aoliva@redhat.com>
+
+	* decl.c (GNU_INLINE_P): New.
+	(duplicate_decls): Handle gnu_inline.  Merge attributes and
+	some flags in overriding definitions.
+	(redeclaration_error_message): Handle gnu_inline.
+	(start_preparsed_function): Likewise.
+
 2007-08-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* call.c (sufficient_parms_p): Constify.


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