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

gcctest@suse.de gcctest@suse.de
Wed Jun 6 04: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: 7417k
    Peak memory use before GGC: 2351k
    Peak memory use after GGC: 2015k
    Maximum of released memory in single GGC run: 336k
    Garbage: 489k
    Leak: 2278k
    Overhead: 404k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7433k
    Peak memory use before GGC: 2378k
    Peak memory use after GGC: 2043k
    Maximum of released memory in single GGC run: 335k
    Garbage: 491k
    Leak: 2311k
    Overhead: 409k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7525k
    Peak memory use before GGC: 2351k
    Peak memory use after GGC: 2015k
    Maximum of released memory in single GGC run: 336k
    Garbage: 494k
    Leak: 2281k
    Overhead: 405k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 7533k
    Peak memory use before GGC: 2351k
    Peak memory use after GGC: 2015k
    Maximum of released memory in single GGC run: 336k
    Garbage: 498k
    Leak: 2281k
    Overhead: 405k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7533k
    Peak memory use before GGC: 2351k
    Peak memory use after GGC: 2015k
    Maximum of released memory in single GGC run: 336k
    Garbage: 498k
    Leak: 2281k
    Overhead: 405k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 8983k to 9036k, overall 0.59%
  Peak amount of GGC memory still allocated after garbage collecting increased from 8216k to 8274k, overall 0.71%
  Amount of memory still referenced at the end of compilation increased from 6768k to 6898k, overall 1.93%
    Overall memory needed: 17645k -> 17693k
    Peak memory use before GGC: 8983k -> 9036k
    Peak memory use after GGC: 8216k -> 8274k
    Maximum of released memory in single GGC run: 1875k -> 1874k
    Garbage: 37736k -> 37660k
    Leak: 6768k -> 6898k
    Overhead: 4594k -> 4637k
    GGC runs: 277 -> 278

comparing combine.c compilation at -O0 -g level:
  Peak amount of GGC memory allocated before garbage collecting increased from 10721k to 10769k, overall 0.45%
  Peak amount of GGC memory still allocated after garbage collecting increased from 9923k to 9989k, overall 0.67%
  Amount of memory still referenced at the end of compilation increased from 9661k to 9791k, overall 1.35%
    Overall memory needed: 19537k -> 19581k
    Peak memory use before GGC: 10721k -> 10769k
    Peak memory use after GGC: 9923k -> 9989k
    Maximum of released memory in single GGC run: 1558k
    Garbage: 38057k -> 38040k
    Leak: 9661k -> 9791k
    Overhead: 5300k -> 5343k
    GGC runs: 270

comparing combine.c compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 17664k to 17722k, overall 0.33%
  Peak amount of GGC memory still allocated after garbage collecting increased from 17461k to 17518k, overall 0.33%
  Amount of memory still referenced at the end of compilation increased from 6827k to 6956k, overall 1.89%
    Overall memory needed: 29957k -> 29981k
    Peak memory use before GGC: 17664k -> 17722k
    Peak memory use after GGC: 17461k -> 17518k
    Maximum of released memory in single GGC run: 1449k -> 1454k
    Garbage: 50512k -> 50424k
    Leak: 6827k -> 6956k
    Overhead: 5634k -> 5670k
    GGC runs: 353 -> 355

comparing combine.c compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 17716k to 17773k, overall 0.32%
  Peak amount of GGC memory still allocated after garbage collecting increased from 17520k to 17577k, overall 0.33%
  Amount of memory still referenced at the end of compilation increased from 6945k to 7072k, overall 1.83%
    Overall memory needed: 34357k -> 34385k
    Peak memory use before GGC: 17716k -> 17773k
    Peak memory use after GGC: 17520k -> 17577k
    Maximum of released memory in single GGC run: 1390k -> 1366k
    Garbage: 67387k -> 67218k
    Leak: 6945k -> 7072k
    Overhead: 7777k -> 7791k
    GGC runs: 417 -> 415

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 17923k to 17972k, overall 0.27%
  Peak amount of GGC memory still allocated after garbage collecting increased from 17664k to 17722k, overall 0.33%
  Amount of memory still referenced at the end of compilation increased from 7070k to 7188k, overall 1.66%
    Overall memory needed: 40769k -> 40965k
    Peak memory use before GGC: 17923k -> 17972k
    Peak memory use after GGC: 17664k -> 17722k
    Maximum of released memory in single GGC run: 3637k -> 3718k
    Garbage: 92467k -> 92291k
    Leak: 7070k -> 7188k
    Overhead: 10980k -> 11012k
    GGC runs: 442 -> 443

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 92893k -> 92901k
    Peak memory use before GGC: 58855k -> 58854k
    Peak memory use after GGC: 33350k
    Maximum of released memory in single GGC run: 33674k
    Garbage: 129179k -> 129135k
    Leak: 9739k -> 9740k
    Overhead: 13788k -> 13775k
    GGC runs: 215

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 94153k -> 94161k
    Peak memory use before GGC: 60017k -> 60016k
    Peak memory use after GGC: 34511k
    Maximum of released memory in single GGC run: 33675k
    Garbage: 129394k -> 129355k
    Leak: 11447k -> 11449k
    Overhead: 14185k -> 14173k
    GGC runs: 213 -> 211

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 107621k -> 107505k
    Peak memory use before GGC: 58476k -> 58477k
    Peak memory use after GGC: 53818k -> 53807k
    Maximum of released memory in single GGC run: 24262k -> 24263k
    Garbage: 211671k -> 211564k
    Leak: 9624k -> 9626k
    Overhead: 23938k -> 23925k
    GGC runs: 243 -> 242

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 168297k -> 163693k
    Peak memory use before GGC: 58362k -> 58358k
    Peak memory use after GGC: 53908k -> 53896k
    Maximum of released memory in single GGC run: 20512k -> 20511k
    Garbage: 246390k -> 246273k
    Leak: 9618k -> 9616k
    Overhead: 29482k -> 29474k
    GGC runs: 264 -> 263

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 178321k -> 178257k
    Peak memory use before GGC: 69172k -> 69165k
    Peak memory use after GGC: 64712k -> 64705k
    Maximum of released memory in single GGC run: 22128k -> 22124k
    Garbage: 275537k -> 275374k
    Leak: 9628k -> 9626k
    Overhead: 31206k -> 31197k
    GGC runs: 264

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147300k -> 145897k
    Peak memory use before GGC: 90174k -> 89180k
    Peak memory use after GGC: 89269k -> 88297k
    Maximum of released memory in single GGC run: 18609k -> 18129k
    Garbage: 208435k -> 206670k
    Leak: 51106k -> 51067k
    Overhead: 23465k -> 23308k
    GGC runs: 409 -> 408

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 165352k -> 163601k
    Peak memory use before GGC: 102911k -> 101737k
    Peak memory use after GGC: 101887k -> 100730k
    Maximum of released memory in single GGC run: 19093k -> 18433k
    Garbage: 214106k -> 212346k
    Leak: 74416k -> 74376k
    Overhead: 29361k -> 29203k
    GGC runs: 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 144747k -> 141587k
    Peak memory use before GGC: 102824k -> 100476k
    Peak memory use after GGC: 101765k -> 99480k
    Maximum of released memory in single GGC run: 17649k -> 17444k
    Garbage: 341528k -> 336573k
    Leak: 51645k -> 51664k
    Overhead: 31059k -> 30234k
    GGC runs: 527 -> 525

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 150407k -> 146587k
    Peak memory use before GGC: 102772k -> 100739k
    Peak memory use after GGC: 101752k -> 99738k
    Maximum of released memory in single GGC run: 17650k -> 17443k
    Garbage: 390707k -> 384411k
    Leak: 52875k -> 52375k
    Overhead: 36799k -> 35792k
    GGC runs: 575 -> 576

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 152067k -> 148731k
    Peak memory use before GGC: 104743k -> 102438k
    Peak memory use after GGC: 103704k -> 101420k
    Maximum of released memory in single GGC run: 18053k -> 17899k
    Garbage: 425320k -> 417088k
    Leak: 53173k -> 52983k
    Overhead: 39390k -> 38339k
    GGC runs: 602 -> 600

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 287755k
    Peak memory use before GGC: 103121k
    Peak memory use after GGC: 58775k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 178492k
    Leak: 7628k
    Overhead: 29161k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 288543k
    Peak memory use before GGC: 103768k
    Peak memory use after GGC: 59421k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 178589k
    Leak: 9396k
    Overhead: 29656k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Ovarall memory allocated via mmap and sbrk decreased from 538497k to 243841k, overall -120.84%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 148303k to 83517k, overall -77.57%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 94021k to 74916k, overall -25.50%
  Amount of produced GGC garbage decreased from 321868k to 223020k, overall -44.32%
  Amount of memory still referenced at the end of compilation decreased from 22574k to 20871k, overall -8.16%
    Overall memory needed: 538497k -> 243841k
    Peak memory use before GGC: 148303k -> 83517k
    Peak memory use after GGC: 94021k -> 74916k
    Maximum of released memory in single GGC run: 76095k -> 39402k
    Garbage: 321868k -> 223020k
    Leak: 22574k -> 20871k
    Overhead: 49023k -> 29035k
    GGC runs: 85 -> 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
  Ovarall memory allocated via mmap and sbrk decreased from 283213k to 264777k, overall -6.96%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 118547k to 79902k, overall -48.37%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 94017k to 74916k, overall -25.50%
  Amount of produced GGC garbage decreased from 330350k to 229683k, overall -43.83%
  Amount of memory still referenced at the end of compilation decreased from 22665k to 20961k, overall -8.13%
    Overall memory needed: 283213k -> 264777k
    Peak memory use before GGC: 118547k -> 79902k
    Peak memory use after GGC: 94017k -> 74916k
    Maximum of released memory in single GGC run: 57289k -> 33017k
    Garbage: 330350k -> 229683k
    Leak: 22665k -> 20961k
    Overhead: 52643k -> 31054k
    GGC runs: 93 -> 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
Reference run miss the results so I can't compare, sadly
    Overall memory needed: 1721513k -> 1293745k
    Peak memory use before GGC: 177945k -> 183656k
    Peak memory use after GGC: 150997k -> 171172k
    Maximum of released memory in single GGC run: 57943k -> 80649k
    Garbage: 0k -> 342922k
    Leak: 0k -> 46328k
    Overhead: 0k -> 42245k
    GGC runs: 73

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-06-05 08:55:55.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-06-06 02:18:06.000000000 +0000
@@ -1,3 +1,106 @@
+2007-06-05  Joerg Wunsch  <j.gnu@uriah.heep.sax.de>
+
+	PR preprocessor/23479
+	* doc/extend.texi: Document the 0b-prefixed binary integer
+	constant extension.
+	
+2007-06-05  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR tree-optimization/32215
+	* tree-vectorizer.c (supportable_widening_operation): Return false
+	for unsupported FIX_TRUNC_EXPR tree code.
+	(supportable_narrowing_operation): Ditto for FLOAT_EXPR tree code.
+
+2007-06-06  Nathan Froyd  <froydnj@codesourcery.com>
+
+	* config/rs6000/rs6000.h (FIXED_SCRATCH): Use r0 as a scratch
+	register on SPE targets.  Change documentation to reflect
+	reality.
+	* config/rs6000/rs6000.c (rs6000_conditional_register_usage):
+	Change FIXED_SCRATCH to 14 and document why we're keeping r14
+	out of the register allocation pool.
+	(rs6000_reg_live_or_pic_offset_p): New function.
+	(rs6000_emit_prologue): Move the actual saving of LR up to free
+	r0 for holding r11.  Split saving of SPE 64-bit registers into
+	its own case.  Ensure that offsets will always be in-range for
+	'evstdd' by using r11 as a scratch register to point at the start
+	of the SPE save area.  Save r11 if necessary, as it is the static
+	chain register.
+	(rs6000_emit_epilogue): Split restoring of SPE 64-bit registers
+	into its own case.  Ensure that offsets will always be in-range
+	for 'evldd' by using r11 as a scratch register to point at the
+	start of the SPE save area.  Also adjust r11 when restoring
+	the stack pointer to compensate for pre-loading r11.
+
+2007-06-05  Thomas Neumann  <tneumann@users.sourceforge.net>
+
+	* cfg.c (init_flow): Use type safe memory macros.
+	(alloc_block): Likewise.
+	(unchecked_make_edge): Likewise.
+	(dump_flow_info): Avoid using C++ keywords as variable names.
+	(copy_original_table_clear): Cast according to the coding conventions.
+	(copy_original_table_set): Likewise.
+	* cfgexpand (label_rtx_for_bb): Likewise.
+	(expand_gimple_basic_block): Likewise.
+	* cfghooks.c (dump_bb): Likewise.
+	(lv_adjust_loop_header_phi): Avoid using C++ keywords as variable names.
+	(lv_add_condition_to_bb): Likewise.
+	* cfglayout (relink_block_chain): Cast according to the coding
+	conventions.
+	(fixup_reorder_chain): Likewise.
+	(fixup_fallthru_exit_predecessor): Likewise.
+	* cfgloop.c (glb_enum_p): Likewise.
+	(get_exit_description): Likewise.
+	(dump_recorded_exit): Likewise.
+	* cfgloop.h (enum loop_estimation): Move out of struct scope...
+	(struct loop): ... from here.
+	* cfgloopmanip.c (rpe_enum_p): Cast according to the coding conventions.
+	* cfgrtl.c (rtl_create_basic_block): Likewise.
+	(rtl_split_block): Likewise.
+	(rtl_dump_bb): Likewise.
+	(cfg_layout_split_block): Likewise.
+	(init_rtl_bb_info): Use typesafe memory macros.
+
+	* graphds.h (struct graph_edge): Renamed edge to graph_edge.
+	* graphds.h: Updated all usages of edge to graph_edge.
+	* graphds.c: Likewise.
+	* cfgloopanal.c: Likewise.
+
+2007-06-05  Ian Lance Taylor  <iant@google.com>
+
+	* tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a
+	PLUS_EXPR or MINUS_EXPR node before setting *strict_overflow_p.
+	(extract_range_from_assert): Set TREE_NO_WARNING when creating an
+	expression.
+	(test_for_singularity): Likewise.
+
+2007-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/i386/constraints.md ("Y2"): Replaced by ...
+	("Yt"): This.
+	* config/i386/i386.md: Likewise.
+	* config/i386/mmx.md: Likewise.
+	* config/i386/sse.md: Likewise.
+
+2007-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/i386/constraints.md ("z"): Replaced by ...
+	("Y0"): This.
+	* config/i386/sse.md (sse4_1_blendvpd): Likewise.
+	(sse4_1_blendvps): Likewise.
+	(sse4_1_pblendvb): Likewise.
+	(sse4_2_pcmpestr): Likewise.
+	(sse4_2_pcmpestrm): Likewise.
+	(sse4_2_pcmpestr_cconly): Likewise.
+	(sse4_2_pcmpistr): Likewise.
+	(sse4_2_pcmpistrm): Likewise.
+	(sse4_2_pcmpistr_cconly): Likewise.
+
+2007-06-05  Razya Ladelsky  <razya@il.ibm.com>
+
+	* matrix-reorg.c (transform_access_sites): Fix computation.
+	(transform_allocation_sites): Same.
+
 2007-06-05  Uros Bizjak  <ubizjak@gmail.com>
 
 	* config/i386/i386.c (override_options): Use
@@ -7181,7 +7284,7 @@
 
 	* c-common.c (warn_logical_operator): Fix condition.
 
-2007-03-10  Tobias Schl?ter  <tobi@gcc.gnu.org>
+2007-03-10  Tobias Schl???ter  <tobi@gcc.gnu.org>
 
 	* config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Add missing
 	quotation mark.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-06-05 08:55:51.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-06-06 02:18:06.000000000 +0000
@@ -1,3 +1,8 @@
+2007-06-04  Simon Baldwin  <simonb@google.com>
+
+	* decl.c (grokdeclarator): Readability change.  Moved case labels
+	into direct switch statement scope.
+
 2007-06-04  Paolo Carlini  <pcarlini@suse.de>
 
 	* call.c (convert_like_real): Remove pointless code.


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