A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Sun Nov 25 19:04: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: 6630k
    Peak memory use before GGC: 1095k
    Peak memory use after GGC: 993k
    Maximum of released memory in single GGC run: 129k
    Garbage: 237k -> 237k
    Leak: 951k -> 951k
    Overhead: 80k -> 80k
    GGC runs: 2

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 6646k
    Peak memory use before GGC: 1122k
    Peak memory use after GGC: 1020k
    Maximum of released memory in single GGC run: 131k
    Garbage: 239k -> 239k
    Leak: 983k -> 983k
    Overhead: 84k -> 84k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 6694k
    Peak memory use before GGC: 1095k
    Peak memory use after GGC: 993k
    Maximum of released memory in single GGC run: 131k
    Garbage: 239k -> 239k
    Leak: 951k -> 951k
    Overhead: 80k -> 80k
    GGC runs: 2

comparing empty function compilation at -O2 level:
    Overall memory needed: 6710k
    Peak memory use before GGC: 1095k
    Peak memory use after GGC: 994k
    Maximum of released memory in single GGC run: 134k
    Garbage: 242k -> 242k
    Leak: 952k -> 952k
    Overhead: 81k -> 81k
    GGC runs: 2

comparing empty function compilation at -O3 level:
    Overall memory needed: 6710k
    Peak memory use before GGC: 1095k
    Peak memory use after GGC: 994k
    Maximum of released memory in single GGC run: 134k
    Garbage: 242k -> 242k
    Leak: 952k -> 952k
    Overhead: 81k -> 81k
    GGC runs: 2

comparing combine.c compilation at -O0 level:
    Overall memory needed: 21178k
    Peak memory use before GGC: 7806k
    Peak memory use after GGC: 7185k
    Maximum of released memory in single GGC run: 1550k
    Garbage: 37870k -> 37872k
    Leak: 5511k -> 5512k
    Overhead: 4574k -> 4577k
    GGC runs: 371

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 23182k
    Peak memory use before GGC: 9647k
    Peak memory use after GGC: 8953k
    Maximum of released memory in single GGC run: 1838k
    Garbage: 38230k -> 38232k
    Leak: 8316k -> 8317k
    Overhead: 5202k -> 5204k
    GGC runs: 342

comparing combine.c compilation at -O1 level:
    Overall memory needed: 31678k
    Peak memory use before GGC: 16354k
    Peak memory use after GGC: 16184k
    Maximum of released memory in single GGC run: 1367k
    Garbage: 51665k -> 51668k
    Leak: 5659k -> 5659k
    Overhead: 5716k -> 5719k
    GGC runs: 442

comparing combine.c compilation at -O2 level:
    Overall memory needed: 33562k
    Peak memory use before GGC: 16434k
    Peak memory use after GGC: 16271k
    Maximum of released memory in single GGC run: 1316k
    Garbage: 70988k -> 70991k
    Leak: 5985k -> 5985k
    Overhead: 8011k -> 8014k
    GGC runs: 510

comparing combine.c compilation at -O3 level:
    Overall memory needed: 37878k
    Peak memory use before GGC: 16657k
    Peak memory use after GGC: 16380k
    Maximum of released memory in single GGC run: 2120k
    Garbage: 92702k -> 92705k
    Leak: 6105k -> 6105k
    Overhead: 10589k -> 10593k
    GGC runs: 545

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 135922k
    Peak memory use before GGC: 56998k
    Peak memory use after GGC: 31455k
    Maximum of released memory in single GGC run: 33256k
    Garbage: 128179k -> 128179k
    Leak: 8380k -> 8380k
    Overhead: 13926k -> 13927k
    GGC runs: 292

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 137178k
    Peak memory use before GGC: 58140k
    Peak memory use after GGC: 32597k
    Maximum of released memory in single GGC run: 33256k
    Garbage: 128409k -> 128410k
    Leak: 10040k -> 10040k
    Overhead: 14282k -> 14283k
    GGC runs: 289

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 143186k
    Peak memory use before GGC: 56210k
    Peak memory use after GGC: 49982k
    Maximum of released memory in single GGC run: 23976k
    Garbage: 206548k -> 206549k
    Leak: 9274k -> 9274k
    Overhead: 23997k -> 23998k
    GGC runs: 315

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 186558k
    Peak memory use before GGC: 56849k
    Peak memory use after GGC: 51569k
    Maximum of released memory in single GGC run: 22720k
    Garbage: 247842k -> 247843k
    Leak: 10361k -> 10361k
    Overhead: 29739k -> 29741k
    GGC runs: 345

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 190982k
    Peak memory use before GGC: 68525k
    Peak memory use after GGC: 62278k
    Maximum of released memory in single GGC run: 23239k
    Garbage: 275916k -> 275917k
    Leak: 10397k -> 10397k
    Overhead: 31624k -> 31625k
    GGC runs: 350

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147488k
    Peak memory use before GGC: 84523k
    Peak memory use after GGC: 83686k
    Maximum of released memory in single GGC run: 16844k
    Garbage: 202344k -> 202440k
    Leak: 48125k -> 48152k
    Overhead: 23725k -> 23847k
    GGC runs: 420

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 168260k
    Peak memory use before GGC: 96488k
    Peak memory use after GGC: 95531k
    Maximum of released memory in single GGC run: 17652k
    Garbage: 207868k -> 207964k
    Leak: 69738k -> 69765k
    Overhead: 28710k -> 28833k
    GGC runs: 392

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of produced GGC garbage increased from 283635k to 284039k, overall 0.14%
    Overall memory needed: 114621k
    Peak memory use before GGC: 83997k
    Peak memory use after GGC: 83161k
    Maximum of released memory in single GGC run: 16342k
    Garbage: 283635k -> 284039k
    Leak: 47353k -> 47382k
    Overhead: 27855k -> 28287k
    GGC runs: 522

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Amount of produced GGC garbage increased from 349068k to 349498k, overall 0.12%
    Overall memory needed: 116081k
    Peak memory use before GGC: 84113k
    Peak memory use after GGC: 83276k
    Maximum of released memory in single GGC run: 16340k
    Garbage: 349068k -> 349498k
    Leak: 48277k -> 48305k
    Overhead: 34760k -> 35218k
    GGC runs: 596

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 380680k to 381114k, overall 0.11%
    Overall memory needed: 121297k
    Peak memory use before GGC: 85266k
    Peak memory use after GGC: 84413k
    Maximum of released memory in single GGC run: 16732k
    Garbage: 380680k -> 381114k
    Leak: 48720k -> 48751k
    Overhead: 37445k -> 37911k
    GGC runs: 628

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 378591k
    Peak memory use before GGC: 101208k
    Peak memory use after GGC: 56862k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 178902k -> 178902k
    Leak: 6097k -> 6097k
    Overhead: 30781k -> 30781k
    GGC runs: 106

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 379391k
    Peak memory use before GGC: 101839k
    Peak memory use after GGC: 57492k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179007k -> 179007k
    Leak: 7799k -> 7799k
    Overhead: 31213k -> 31213k
    GGC runs: 111

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Amount of memory still referenced at the end of compilation increased from 16006k to 16072k, overall 0.41%
    Overall memory needed: 436390k
    Peak memory use before GGC: 78856k
    Peak memory use after GGC: 69705k
    Maximum of released memory in single GGC run: 37753k
    Garbage: 234244k -> 234281k
    Leak: 16006k -> 16072k
    Overhead: 35358k -> 35461k
    GGC runs: 105

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
  Amount of memory still referenced at the end of compilation increased from 16178k to 16244k, overall 0.41%
    Overall memory needed: 350866k
    Peak memory use before GGC: 74692k
    Peak memory use after GGC: 69706k
    Maximum of released memory in single GGC run: 32246k
    Garbage: 245723k -> 245760k
    Leak: 16178k -> 16244k
    Overhead: 38676k -> 38779k
    GGC runs: 117

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
  Amount of memory still referenced at the end of compilation increased from 24557k to 24882k, overall 1.32%
    Overall memory needed: 1305114k
    Peak memory use before GGC: 130289k
    Peak memory use after GGC: 120623k
    Maximum of released memory in single GGC run: 61473k
    Garbage: 359151k -> 359262k
    Leak: 24557k -> 24882k
    Overhead: 46972k -> 47407k
    GGC runs: 105

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-11-25 00:51:07.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-11-25 16:44:09.000000000 +0000
@@ -1,3 +1,21 @@
+2007-11-25  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+	* tree-sra.c (scalarize_use): Adjust the vpos argument to
+	sra_explode_bitfield_assignment in cases where the type is
+	wider than the bitfield.
+
+2007-11-25  Richard Guenther  <rguenther@suse.de>
+
+	* tree.h (struct tree_block): Move locus member next to
+	flags.
+	* c-decl.c (SCOPE_LIST_APPEND): Use BLOCK_CHAIN.
+	(SCOPE_LIST_CONCAT): Likewise.
+	(pop_scope): Likewise.
+	* function.c (instantiate_decls_1): Likewise.
+	(setjmp_vars_warning): Likewise.
+	* emit-rtl.c (set_used_decls): Likewise.
+	* tree-inline.c (add_lexical_block): Likewise.
+
 2007-11-24  Hans-Peter Nilsson  <hp@axis.com>
 
 	* rtlanal.c (label_is_jump_target_p): Return true for a matching
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-11-24 08:58:55.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-11-25 16:44:09.000000000 +0000
@@ -1,3 +1,7 @@
+2007-11-25  Richard Guenther  <rguenther@suse.de>
+
+	decl.c (poplevel): Use BLOCK_CHAIN.
+
 2007-11-24  Ollie Wild  <aaw@google.com>
 
 	* typeck.c (delta_from_ptrmemfunc): New function.


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