A recent patch increased GCC's memory consumption in some cases!

gcctest@suse.de gcctest@suse.de
Fri Mar 16 03:19: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: 7381k -> 7383k
    Peak memory use before GGC: 2260k
    Peak memory use after GGC: 1949k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2283k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7401k -> 7399k
    Peak memory use before GGC: 2288k
    Peak memory use after GGC: 1977k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2316k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7509k -> 7511k
    Peak memory use before GGC: 2260k
    Peak memory use after GGC: 1949k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7577k -> 7579k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7577k -> 7579k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17721k -> 17723k
    Peak memory use before GGC: 9262k
    Peak memory use after GGC: 8849k
    Maximum of released memory in single GGC run: 2578k
    Garbage: 37145k -> 37152k
    Leak: 6578k
    Overhead: 5053k -> 5053k
    GGC runs: 283 -> 282

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19861k -> 19863k
    Peak memory use before GGC: 10877k
    Peak memory use after GGC: 10509k
    Maximum of released memory in single GGC run: 2351k
    Garbage: 37718k -> 37718k
    Leak: 9471k
    Overhead: 5759k -> 5759k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35249k -> 35247k
    Peak memory use before GGC: 19331k
    Peak memory use after GGC: 19125k
    Maximum of released memory in single GGC run: 2177k
    Garbage: 56868k -> 56868k
    Leak: 6607k
    Overhead: 6313k -> 6313k
    GGC runs: 353

comparing combine.c compilation at -O2 level:
  Amount of memory still referenced at the end of compilation increased from 6720k to 6735k, overall 0.22%
    Overall memory needed: 37521k -> 37515k
    Peak memory use before GGC: 19371k
    Peak memory use after GGC: 19177k
    Maximum of released memory in single GGC run: 2164k
    Garbage: 68467k -> 68456k
    Leak: 6720k -> 6735k
    Overhead: 8049k -> 8049k
    GGC runs: 407 -> 408

comparing combine.c compilation at -O3 level:
    Overall memory needed: 41873k -> 41875k
    Peak memory use before GGC: 19525k
    Peak memory use after GGC: 19263k
    Maximum of released memory in single GGC run: 3035k
    Garbage: 88443k -> 88459k
    Leak: 6845k -> 6837k
    Overhead: 10862k -> 10864k
    GGC runs: 431

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 102961k -> 102971k
    Peak memory use before GGC: 68624k
    Peak memory use after GGC: 44728k
    Maximum of released memory in single GGC run: 36429k
    Garbage: 131233k
    Leak: 9581k
    Overhead: 16927k
    GGC runs: 212

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104201k -> 104211k
    Peak memory use before GGC: 69786k
    Peak memory use after GGC: 45996k
    Maximum of released memory in single GGC run: 36430k
    Garbage: 132452k
    Leak: 11289k
    Overhead: 17324k
    GGC runs: 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147589k -> 145595k
    Peak memory use before GGC: 85946k
    Peak memory use after GGC: 80068k
    Maximum of released memory in single GGC run: 32842k
    Garbage: 265258k
    Leak: 9401k
    Overhead: 27688k
    GGC runs: 227

comparing insn-attrtab.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 193413k to 197859k, overall 2.30%
    Overall memory needed: 193413k -> 197859k
    Peak memory use before GGC: 87233k
    Peak memory use after GGC: 80138k
    Maximum of released memory in single GGC run: 30051k
    Garbage: 301440k
    Leak: 9399k
    Overhead: 33331k
    GGC runs: 248

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 193449k -> 194071k
    Peak memory use before GGC: 87247k
    Peak memory use after GGC: 80152k
    Maximum of released memory in single GGC run: 30112k
    Garbage: 302087k
    Leak: 9404k
    Overhead: 33530k
    GGC runs: 247

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Ovarall memory allocated via mmap and sbrk decreased from 174524k to 147363k, overall -18.43%
  Amount of memory still referenced at the end of compilation increased from 49106k to 49207k, overall 0.21%
    Overall memory needed: 174524k -> 147363k
    Peak memory use before GGC: 90285k -> 90241k
    Peak memory use after GGC: 89390k -> 89347k
    Maximum of released memory in single GGC run: 17776k -> 17774k
    Garbage: 208054k -> 208227k
    Leak: 49106k -> 49207k
    Overhead: 23578k -> 23914k
    GGC runs: 411

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
  Ovarall memory allocated via mmap and sbrk decreased from 192376k to 165187k, overall -16.46%
  Amount of memory still referenced at the end of compilation increased from 72419k to 72520k, overall 0.14%
    Overall memory needed: 192376k -> 165187k
    Peak memory use before GGC: 102889k -> 102846k
    Peak memory use after GGC: 101870k -> 101827k
    Maximum of released memory in single GGC run: 18129k
    Garbage: 214600k -> 214771k
    Leak: 72419k -> 72520k
    Overhead: 29475k -> 29811k
    GGC runs: 384 -> 385

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Ovarall memory allocated via mmap and sbrk decreased from 169044k to 141880k, overall -19.15%
  Amount of memory still referenced at the end of compilation increased from 49839k to 49940k, overall 0.20%
    Overall memory needed: 169044k -> 141880k
    Peak memory use before GGC: 101851k -> 101808k
    Peak memory use after GGC: 100834k -> 100791k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 345587k -> 345640k
    Leak: 49839k -> 49940k
    Overhead: 30223k -> 30553k
    GGC runs: 527 -> 528

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Ovarall memory allocated via mmap and sbrk decreased from 170896k to 143712k, overall -18.92%
  Amount of memory still referenced at the end of compilation increased from 50873k to 50974k, overall 0.20%
    Overall memory needed: 170896k -> 143712k
    Peak memory use before GGC: 102463k -> 102419k
    Peak memory use after GGC: 101446k -> 101403k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 374579k -> 374631k
    Leak: 50873k -> 50974k
    Overhead: 34227k -> 34557k
    GGC runs: 563 -> 565

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 173516k to 146340k, overall -18.57%
  Amount of memory still referenced at the end of compilation increased from 51158k to 51261k, overall 0.20%
    Overall memory needed: 173516k -> 146340k
    Peak memory use before GGC: 104283k -> 104239k
    Peak memory use after GGC: 103250k -> 103207k
    Maximum of released memory in single GGC run: 17610k -> 17611k
    Garbage: 392632k -> 392689k
    Leak: 51158k -> 51261k
    Overhead: 35658k -> 35994k
    GGC runs: 574 -> 575

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244573k -> 244576k
    Peak memory use before GGC: 80960k
    Peak memory use after GGC: 58699k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 144344k
    Leak: 7611k
    Overhead: 24815k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245409k -> 245412k
    Peak memory use before GGC: 81606k
    Peak memory use after GGC: 59345k
    Maximum of released memory in single GGC run: 44122k
    Garbage: 144515k
    Leak: 9378k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245197k -> 245275k
    Peak memory use before GGC: 85157k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 36137k
    Garbage: 222621k
    Leak: 20854k
    Overhead: 30548k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 498645k -> 498491k
    Peak memory use before GGC: 79831k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 33438k
    Garbage: 229668k
    Leak: 20944k
    Overhead: 32630k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1215357k -> 1215435k
    Peak memory use before GGC: 201747k
    Peak memory use after GGC: 190209k
    Maximum of released memory in single GGC run: 80686k
    Garbage: 363594k
    Leak: 46310k
    Overhead: 46513k
    GGC runs: 71

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-03-14 16:17:40.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-03-16 01:13:49.000000000 +0000
@@ -1,3 +1,149 @@
+2007-03-15  DJ Delorie  <dj@redhat.com>
+
+	* config/frv/predicates.md (minmax_operator): Don't check operands
+	here.
+
+2007-03-15  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-ssa-loop-niter.c (record_estimate): Add "upper" argument.
+	Update constant estimates of number of iterations.
+	(record_nonwrapping_iv): Add "upper" argument.  "data_size_bounds_p"
+	argument renamed to "realistic".
+	(compute_estimated_nb_iterations): Removed.
+	(record_niter_bound): New function.
+	(idx_infer_loop_bounds): For possible but unlikely tail arrays,
+	call record_nonwrapping_iv with upper = false.
+	(infer_loop_bounds_from_signedness): Pass upper argument to
+	record_nonwrapping_iv.
+	(estimate_numbers_of_iterations_loop): Do not call
+	compute_estimated_nb_iterations.  Record estimate based on profile
+	information.  Initialize the constant estimates of number of
+	iterations.
+	* tree-data-ref.c (estimated_loop_iterations): Return the recorded
+	estimates.
+	* tree-ssa-loop-prefetch.c (loop_prefetch_arrays): Add dump when
+	number of iterations is too small.
+	* cfgloop.h (struct nb_iter_bound): Remove "realistic" field.
+	(EST_NOT_AVAILABLE): Removed.
+	(struct loop): Replace estimated_nb_iterations by any_upper_bound,
+	nb_iterations_upper_bound, any_estimate and nb_iterations_estimate
+	fields.
+
+2007-03-15  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-ssa-loop-niter.c (refine_bounds_using_guard, bound_difference):
+	Handle NE_EXPR guards.
+
+2007-03-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR c++/24924
+	* c-opts.c (c_common_post_options): Handle C++ post-processing here.
+	Set also -pedantic-errors by default for the  preprocessor unless
+	-fpermissive is given.
+	
+2007-03-15  Richard Guenther  <rguenther@suse.de>
+
+	PR middle-end/29719
+	PR middle-end/31161
+	* builtins.c (expand_builtin_cexpi): As a fallback if we
+	don't have builtins for sincos or cexp create a function
+	declaration for cexp and expand to a call to that.
+	(expand_builtin_int_roundingfn): Always fall
+	back to floor/ceil and its variants even if they may be
+	not available.
+
+2007-03-15  Steven Bosscher  <steven@gcc.gnu.org>
+
+	PR middle-end/31159
+	* cfglayout.c (fixup_reorder_chain): Postpone deleting dead
+	jump tables, move the call to delete_dead_jumptables from here...
+	(cfg_layout_finalize): ...to here.  But rebuild jump labels first.
+	* cfgrtl.c (cfg_layout_can_merge_blocks_p): When not optimizing,
+	don't allow merging of blocks that try_redirect_by_replacing_jump
+	also does not handle when not optimizing.
+
+2007-03-15  Uros Bizjak  <ubizjak@gmail.com>
+	    Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	* config/i386/i386.md (x86_sahf_1): Correctly handle
+	HAVE_AS_IX86_SAHF.
+
+2007-03-15  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/31167
+	* config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
+	x86_64_general_operand as operand[2] predicate.  Remove "iF"
+	from operand constraints and use "e" constraint instead.
+	(*subti3_1, *subti3_1 splitter): Ditto.
+	(*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
+	operand[1] predicate.
+
+2007-03-14  Sebastian Pop  <sebastian.pop@inria.fr>
+
+	* tree-loop-linear.c (gather_interchange_stats): For multidimensional
+	arrays, multiply the access strides by the size of the sub-array.
+	* testsuite/gcc.dg/tree-ssa/ltrans-5.c: New.
+
+2007-03-14  Uros Bizjak  <ubizjak@gmail.com>
+
+	* configure.ac (HAVE_AS_IX86_SAHF): On x86 targets check whether
+	the configured assembler supports the sahf mnemonic.
+	* configure: Regenerate.
+	* config.in: Regenerate.
+
+	* config/i386/i386.md (x86_sahf_1): Depending on HAVE_AS_IX86_SAHF,
+	emit "sahf" or ".byte\t0x9e" as asm template.
+
+2007-03-14  Michael Meissner  <michael.meissner@amd.com>
+
+	PR 31018
+	* config/i386/i386.h (X86_TUNE_SHORTEN_X87_SSE): New tuning
+	option to replace hard coded TARGET_xxx in md file.
+	(X86_TUNE_AVOID_VECTOR_DECODE): Ditto.
+	(X86_TUNE_SLOW_IMUL_IMM32_MEM): Ditto.
+	(X86_TUNE_SLOW_IMUL_IMM8): Ditto.
+	(X86_TUNE_MOVE_M1_VIA_OR): Ditto.
+	(X86_TUNE_NOT_UNPAIRABLE): Ditto.
+	(X86_TUNE_NOT_VECTORMODE): Ditto.
+	(TUNE_SHORTEN_X87_SSE): Use new tuning option.
+	(TUNE_AVOID_VECTOR_DECODE): Ditto.
+	(TUNE_SLOW_IMUL_IMM32_MEM): Ditto.
+	(TUNE_SLOW_IMUL_IMM8): Ditto.
+	(TUNE_MOVE_M1_VIA_OR): Ditto.
+	(TUNE_NOT_UNPAIRABLE): Ditto.
+	(TUNE_NOT_VECTORMODE): Ditto.
+	
+	* config/i386/i386.c (ix86_tune_features): Fill in new tuning
+	options.
+
+	* config/i386/i386.md (fix_trunc?f?1_sse peephole2): Use new
+	tuning options instead of hard coded TARGET_xxx.
+	(fix ssemode peephole2's): Ditto.
+	(imul peephole2's): Ditto.
+	(movsi_or): Ditto.
+	(movdi_or_rex64): Ditto.
+	(move peephole2): Ditto.
+	(not peephole2's): Ditto.
+
+2007-03-14  Dirk Mueller  <dmueller@suse.de>
+
+	* c-common.h (empty_body_warning): Rename to empty_if_body_warning.
+	* c-common.c (empty_if_body_warning): Rephrase diagnostic message.
+	* c-parser.c (c_parser_if_body): Always add an empty statement in case
+	of empty body.
+	* c-parser.c (c_parser_do_statement): Warn about empty body in
+	do/while statement.
+	* c-typeck (c_finish_if_stmt): Call empty_if_body_warning.
+	* doc/invoke.texi (-Wempty-body): Update documentation.
+
+2007-03-14  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR c/21438
+	* c-common.h (warn_for_div_by_zero): Declare.
+	* c-common.c (warn_for_div_by_zero): Define.
+	* c-typeck.c (build_binary_op): Call warn_for_div_zero instead of
+	warning.
+
 2007-03-14  Richard Sandiford  <richard@codesourcery.com>
 
 	* Makefile.in (PREPROCESSOR_DEFINES): Add directory terminators
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-03-14 16:17:39.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-03-16 01:13:48.000000000 +0000
@@ -1,3 +1,71 @@
+2007-03-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR c++/30891
+	* parser.c (cp_parser_statement): If 'namespace' is found, this
+	only can be a namespace alias definition, so parse it now.
+	(cp_parser_namespace_alias_definition): if we find an open brace
+	instead of '=', then this is actually a misplaced namespace
+	definition.
+	
+2007-03-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR c++/24924
+	* decl.c (cxx_init_decl_processing): Move command-line options
+	processing to c-opts.c.
+	
+2007-03-15  Douglas Gregor  <doug.gregor@gmail.com>
+
+	* ptree.c (cxx_print_type): Use formatting markup for integers
+	when printing template parameter index/level/orig level.
+	(cxx_print_xnode): Ditto.
+	* cp-tree.h (TEMPLATE_PARM_PARAMETER_PACK): Use TREE_LANG_FLAG_0.
+	(struct template_parm_index_s): Remove the PARAMETER_PACK member.
+	Make INDEX, LEVEL, and ORIG_LEVEL integers instead of
+	HOST_WIDE_INTs.
+	(struct saved_scope): Make X_PROCESSING_TEMPLATE_DECL an int,
+	rather than a HOST_WIDE_INT.
+	Turn X_PROCESSING_EXPLICIT_INSTANTIATION, SKIP_EVALUATION, and
+	NEED_POP_FUNCTION_CONTEXT into bool bitfields; reorder fields for
+	better bit-packing.
+	(struct language_function): Make RETURNS_VALUE, RETURNS_NULL,
+	RETURNS_ABNORMALLY, IN_FUNCTION_TRY_HANDLER, and
+	IN_BASE_INITIALIZER bool bitfields.
+	(struct cp_declarator): Make KIND a 4-bit field. Make
+	PARAMETER_PACK_P a bool bitfield just after KIND.
+	* pt.c (uses_parameter_packs): Destroy the pointer set.
+	(make_pack_expansion): Ditto.
+	(check_for_bare_parameter_packs): Ditto.
+	* name-lookup.c (push_to_top_level): Make need_pop a bool value.
+	
+2007-03-14  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+	PR c++/31165
+	* call.c  (convert_default_arg): Instead of copying the node,
+	unshare it.
+
+2007-03-15  Dirk Mueller  <dmueller@suse.de>
+
+	PR c++/30860
+	* call.c (convert_conversion_warnings): New..
+	(convert_like_real): .. factored out from here.
+	(convert_conversion_warnings): Add warning about
+	false being converted to NULL in argument passing.
+
+2007-03-14  Dirk Mueller  <dmueller@suse.de>
+
+	* cp/semantics.c (c_finish_if_stmt): Call empty_if_body_warning.
+	(finish_do_body): Warn about empty body in do/while statement.
+
+2007-03-14  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	* class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning.
+	
+2007-03-14  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR c/21438
+	* typeck.c (build_binary_op): Call warn_for_div_zero instead of
+	warning.
+	
 2007-03-13  Alexandre Oliva  <aoliva@redhat.com>
 
 	* cp/repo.c (init_repo): Initialize random_seed saved options.


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