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

gcctest@suse.de gcctest@suse.de
Wed Mar 14 18:22: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: 7384k -> 7381k
    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: 7400k -> 7401k
    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: 7508k -> 7509k
    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: 7576k -> 7577k
    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: 7576k -> 7577k
    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: 17724k -> 17721k
    Peak memory use before GGC: 9262k
    Peak memory use after GGC: 8849k
    Maximum of released memory in single GGC run: 2578k
    Garbage: 37145k
    Leak: 6578k
    Overhead: 5053k
    GGC runs: 283

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

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

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37512k -> 37521k
    Peak memory use before GGC: 19371k
    Peak memory use after GGC: 19177k
    Maximum of released memory in single GGC run: 2164k
    Garbage: 68466k -> 68467k
    Leak: 6726k -> 6720k
    Overhead: 8044k -> 8049k
    GGC runs: 406 -> 407

comparing combine.c compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 46892k to 41873k, overall -11.99%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 20389k to 19525k, overall -4.43%
  Amount of produced GGC garbage decreased from 101491k to 88443k, overall -14.75%
    Overall memory needed: 46892k -> 41873k
    Peak memory use before GGC: 20389k -> 19525k
    Peak memory use after GGC: 19559k -> 19263k
    Maximum of released memory in single GGC run: 3141k -> 3035k
    Garbage: 101491k -> 88443k
    Leak: 6863k -> 6845k
    Overhead: 12268k -> 10862k
    GGC runs: 456 -> 431

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 102960k -> 102961k
    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: 104204k -> 104201k
    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: 147600k -> 147589k
    Peak memory use before GGC: 85946k
    Peak memory use after GGC: 80068k
    Maximum of released memory in single GGC run: 32842k
    Garbage: 265261k -> 265258k
    Leak: 9401k
    Overhead: 27688k -> 27688k
    GGC runs: 227

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191024k -> 193413k
    Peak memory use before GGC: 87233k
    Peak memory use after GGC: 80138k
    Maximum of released memory in single GGC run: 30051k
    Garbage: 301443k -> 301440k
    Leak: 9399k
    Overhead: 33331k -> 33331k
    GGC runs: 248

comparing insn-attrtab.c compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 189012k to 193449k, overall 2.35%
    Overall memory needed: 189012k -> 193449k
    Peak memory use before GGC: 87247k
    Peak memory use after GGC: 80152k
    Maximum of released memory in single GGC run: 30112k
    Garbage: 302090k -> 302087k
    Leak: 9404k
    Overhead: 33530k -> 33530k
    GGC runs: 247

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 174528k -> 174524k
    Peak memory use before GGC: 90285k
    Peak memory use after GGC: 89390k
    Maximum of released memory in single GGC run: 17776k
    Garbage: 208054k
    Leak: 49106k
    Overhead: 23578k
    GGC runs: 411

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 192344k -> 192376k
    Peak memory use before GGC: 102889k
    Peak memory use after GGC: 101870k
    Maximum of released memory in single GGC run: 18129k
    Garbage: 214600k
    Leak: 72419k
    Overhead: 29475k
    GGC runs: 384

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 168984k -> 169044k
    Peak memory use before GGC: 101851k
    Peak memory use after GGC: 100834k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 345295k -> 345587k
    Leak: 49818k -> 49839k
    Overhead: 30195k -> 30223k
    GGC runs: 527

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Amount of produced GGC garbage increased from 374180k to 374579k, overall 0.11%
    Overall memory needed: 171020k -> 170896k
    Peak memory use before GGC: 102472k -> 102463k
    Peak memory use after GGC: 101452k -> 101446k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 374180k -> 374579k
    Leak: 50850k -> 50873k
    Overhead: 34134k -> 34227k
    GGC runs: 562 -> 563

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 391547k to 392632k, overall 0.28%
    Overall memory needed: 173568k -> 173516k
    Peak memory use before GGC: 104284k -> 104283k
    Peak memory use after GGC: 103250k
    Maximum of released memory in single GGC run: 17610k
    Garbage: 391547k -> 392632k
    Leak: 51133k -> 51158k
    Overhead: 35503k -> 35658k
    GGC runs: 572 -> 574

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244576k -> 244573k
    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: 245408k -> 245409k
    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: 245052k -> 245197k
    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: 498684k -> 498645k
    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: 1215432k -> 1215357k
    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-13 23:45:41.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-03-14 16:17:40.000000000 +0000
@@ -1,3 +1,95 @@
+2007-03-14  Richard Sandiford  <richard@codesourcery.com>
+
+	* Makefile.in (PREPROCESSOR_DEFINES): Add directory terminators
+	to PREFIX and STANDARD_PREFIX.
+
+2007-03-14  Richard Sandiford  <richard@codesourcery.com>
+	    Phil Edwards  <phil@codesourcery.com>
+
+	* gthr-vxworks.h: Add an extern "C" wrapper for C++.
+	(__gthread_once_t): Remove busy field for RTPs.
+	(__GTHREAD_ONCE_INIT): Update accordingly.
+
+2007-03-14  Richard Sandiford  <richard@codesourcery.com>
+
+	* doc/invoke.texi: Document VxWorks options.
+
+2007-03-14  Uros Bizjak  <ubizjak@gmail.com>
+
+	* doc/invoke.texi (i386 and x86-64 Options): Clarify -msahf option.
+
+2007-03-13  Seongbae Park <seongbae.park@gmail.com>
+
+	PR tree-optimization/30590
+	* tree-nrv.c (tree_nrv): Check for the partial update of the
+	return value.
+
+2007-03-13  Alexandre Oliva  <aoliva@redhat.com>
+
+	* flags.h (flag_random_seed): Remove declaration, in favor of...
+	* toplev.h (get_random_seed, set_random_seed): ... these.
+	* tree.c (get_file_function_name): Use the former.
+	* opts.c (common_handle_option): Use the latter.
+	* toplev.c
+
+2007-03-13  Steven Bosscher  <steven@gcc.gnu.org>
+
+	PR middle-end/31127
+	* cse.c (cse_find_path): Do not bail out if a basic block that
+	we already visited now becomes part of a path that starts at a
+	different basic block.  Just disallow this, to make sure we
+	visit each basic block at most once.
+
+2007-03-13  Jan Hubicka  <jh@suse.cz>
+
+	* ipa-inline.c (cgraph_maybe_hot_edge_p): Look for hot/cold attributes,
+	when profile esitmate is present, calls with very low frequency are
+	cold.
+
+2007-03-13  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	PR tree-optimization/30730
+	PR tree-optimization/26900
+	* tree-ssa-loop-niter.c: Include gmp.h.
+	(bounds): New type.
+	(mpz_set_double_int, get_type_bounds, mpz_to_double_int,
+	split_to_var_and_offset, determine_value_range,
+	bound_difference_of_offsetted_base, refine_bounds_using_guard,
+	bound_difference, bounds_add, bounds_negate,
+	number_of_iterations_ne_max, dump_affine_iv): New functions.
+	(number_of_iterations_ne, number_of_iterations_lt_to_ne,
+	assert_loop_rolls_lt, assert_loop_rolls_le): Use bounds on the
+	difference of initial and final value of control iv to validate
+	results.
+	(number_of_iterations_cond): Add loop parameter.  Determine bounds
+	on the difference of the extremes of the control iv.  Add dumps.
+	(expand_simple_operations): Handle phi nodes.
+	(simplify_using_initial_conditions): Do not record used conditions.
+	(number_of_iterations_exit): Pass loop to number_of_iterations_cond.
+	Do not set additional_info.
+	(implies_nonnegative_p, implies_ge_p): Removed.
+	(derive_constant_upper_bound): Do not use parameter `additional'.
+	(record_estimate): Parameter `additional' removed.  Parameter
+	`i_bound' added.  Do not call derive_constant_upper_bound.
+	(record_nonwrapping_iv): Use derive_constant_upper_bound to
+	bound the number of iterations estimate.
+	(estimate_numbers_of_iterations_loop): Pass the estimate from
+	the number of iterations analysis to record_estimate.
+	* tree.h (multiple_of_p): Declare.
+	* tree-scalar-evolution.c (expression_expensive_p): Removed.
+	(scev_const_prop): Do not check expression_expensive_p.
+	* fold-const.c (multiple_of_p): Exported.
+	* double-int.c (double_int_mask): Exported.
+	* double-int.h (double_int_mask): Declare.
+	* tree-flow.h (struct tree_niter_desc): Removed additional_info
+	field.  Added max field.
+
+2007-03-13  David Taylor  <taylor@candd.org>
+
+	PR driver/12448:
+	* gcc.c (cpp_unique_options): If -MT or -MQ is seen, don't pass
+	default -MQ.
+
 2007-03-13  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
 	PR target/31123
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-03-13 07:16:03.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-03-14 16:17:39.000000000 +0000
@@ -1,3 +1,14 @@
+2007-03-13  Alexandre Oliva  <aoliva@redhat.com>
+
+	* cp/repo.c (init_repo): Initialize random_seed saved options.
+	(finish_repo): Adjust.
+
+2007-03-13  Mark Mitchell  <mark@codesourcery.com>
+
+	PR bootstrap/30899
+	* Make-lang.in (doc/g++.1): Use $< to specify the location from
+	which to copy.
+
 2007-03-12  Seongbae Park <seongbae.park@gmail.com>
 
 	* decl.c (compute_array_index_type): New warning flag warn_vla.


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