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

gcctest@suse.de gcctest@suse.de
Sat Feb 24 03:51: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: 7383k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2292k
    Overhead: 456k
    GGC runs: 3

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

comparing empty function compilation at -O1 level:
    Overall memory needed: 7515k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7523k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7523k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17879k
    Peak memory use before GGC: 9277k
    Peak memory use after GGC: 8859k
    Maximum of released memory in single GGC run: 2584k
    Garbage: 37118k
    Leak: 6579k
    Overhead: 5037k
    GGC runs: 279

comparing combine.c compilation at -O0 -g level:
  Amount of memory still referenced at the end of compilation increased from 9464k to 9480k, overall 0.17%
    Overall memory needed: 19891k
    Peak memory use before GGC: 10887k
    Peak memory use after GGC: 10519k
    Maximum of released memory in single GGC run: 2355k
    Garbage: 37710k -> 37710k
    Leak: 9464k -> 9480k
    Overhead: 5741k -> 5744k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35307k -> 35303k
    Peak memory use before GGC: 19350k
    Peak memory use after GGC: 19135k
    Maximum of released memory in single GGC run: 2169k
    Garbage: 57399k
    Leak: 6616k
    Overhead: 6371k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37579k -> 37587k
    Peak memory use before GGC: 19387k
    Peak memory use after GGC: 19185k
    Maximum of released memory in single GGC run: 2157k
    Garbage: 68663k
    Leak: 6725k
    Overhead: 7996k
    GGC runs: 403

comparing combine.c compilation at -O3 level:
    Overall memory needed: 47015k
    Peak memory use before GGC: 20424k
    Peak memory use after GGC: 19542k
    Maximum of released memory in single GGC run: 3135k
    Garbage: 101007k
    Leak: 6865k
    Overhead: 12222k
    GGC runs: 453

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103215k
    Peak memory use before GGC: 68882k
    Peak memory use after GGC: 44737k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 130211k
    Leak: 9350k
    Overhead: 16801k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
  Amount of memory still referenced at the end of compilation increased from 11279k to 11298k, overall 0.17%
    Overall memory needed: 104615k
    Peak memory use before GGC: 70043k
    Peak memory use after GGC: 46005k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 131109k -> 131174k
    Leak: 11279k -> 11298k
    Overhead: 17195k -> 17198k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147623k -> 147627k
    Peak memory use before GGC: 85871k
    Peak memory use after GGC: 80078k
    Maximum of released memory in single GGC run: 32817k
    Garbage: 264120k
    Leak: 9410k
    Overhead: 27484k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191247k -> 191859k
    Peak memory use before GGC: 87187k
    Peak memory use after GGC: 80148k
    Maximum of released memory in single GGC run: 31177k
    Garbage: 298878k
    Leak: 9407k
    Overhead: 33061k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 191811k -> 191823k
    Peak memory use before GGC: 87200k
    Peak memory use after GGC: 80161k
    Maximum of released memory in single GGC run: 31240k
    Garbage: 299536k
    Leak: 9412k
    Overhead: 33260k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Overall memory allocated via mmap and sbrk increased from 127583k to 147690k, overall 15.76%
  Peak amount of GGC memory allocated before garbage collecting increased from 76762k to 90479k, overall 17.87%
  Peak amount of GGC memory still allocated after garbage collecting increased from 76372k to 89583k, overall 17.30%
  Amount of produced GGC garbage increased from 91497k to 209330k, overall 128.78%
  Amount of memory still referenced at the end of compilation decreased from 79975k to 49053k, overall -63.04%
    Overall memory needed: 127583k -> 147690k
    Peak memory use before GGC: 76762k -> 90479k
    Peak memory use after GGC: 76372k -> 89583k
    Maximum of released memory in single GGC run: 4944k -> 18003k
    Garbage: 91497k -> 209330k
    Leak: 79975k -> 49053k
    Overhead: 9886k -> 23532k
    GGC runs: 304 -> 414

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
  Overall memory allocated via mmap and sbrk increased from 131159k to 165618k, overall 26.27%
  Peak amount of GGC memory allocated before garbage collecting increased from 79573k to 103211k, overall 29.71%
  Peak amount of GGC memory still allocated after garbage collecting increased from 79138k to 102187k, overall 29.13%
  Amount of produced GGC garbage increased from 91561k to 215834k, overall 135.73%
  Amount of memory still referenced at the end of compilation decreased from 83277k to 72366k, overall -15.08%
    Overall memory needed: 131159k -> 165618k
    Peak memory use before GGC: 79573k -> 103211k
    Peak memory use after GGC: 79138k -> 102187k
    Maximum of released memory in single GGC run: 4943k -> 18485k
    Garbage: 91561k -> 215834k
    Leak: 83277k -> 72366k
    Overhead: 10544k -> 29426k
    GGC runs: 297 -> 386

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 84395k to 141759k, overall 67.97%
  Peak amount of GGC memory allocated before garbage collecting increased from 75864k to 101823k, overall 34.22%
  Peak amount of GGC memory still allocated after garbage collecting increased from 75556k to 100800k, overall 33.41%
  Amount of produced GGC garbage increased from 91506k to 345391k, overall 277.45%
  Amount of memory still referenced at the end of compilation decreased from 79159k to 49766k, overall -59.06%
    Overall memory needed: 84395k -> 141759k
    Peak memory use before GGC: 75864k -> 101823k
    Peak memory use after GGC: 75556k -> 100800k
    Maximum of released memory in single GGC run: 4943k -> 17236k
    Garbage: 91506k -> 345391k
    Leak: 79159k -> 49766k
    Overhead: 9886k -> 30022k
    GGC runs: 305 -> 528

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 84391k to 143839k, overall 70.44%
  Peak amount of GGC memory allocated before garbage collecting increased from 75861k to 102498k, overall 35.11%
  Peak amount of GGC memory still allocated after garbage collecting increased from 75550k to 101446k, overall 34.28%
  Amount of produced GGC garbage increased from 91508k to 374185k, overall 308.91%
  Amount of memory still referenced at the end of compilation decreased from 79153k to 50369k, overall -57.15%
    Overall memory needed: 84391k -> 143839k
    Peak memory use before GGC: 75861k -> 102498k
    Peak memory use after GGC: 75550k -> 101446k
    Maximum of released memory in single GGC run: 4944k -> 17233k
    Garbage: 91508k -> 374185k
    Leak: 79153k -> 50369k
    Overhead: 9886k -> 33942k
    GGC runs: 305 -> 562

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 85139k to 146427k, overall 71.99%
  Peak amount of GGC memory allocated before garbage collecting increased from 76851k to 104252k, overall 35.65%
  Peak amount of GGC memory still allocated after garbage collecting increased from 76508k to 103218k, overall 34.91%
  Amount of produced GGC garbage increased from 92559k to 391455k, overall 322.92%
  Amount of memory still referenced at the end of compilation decreased from 80161k to 51029k, overall -57.09%
    Overall memory needed: 85139k -> 146427k
    Peak memory use before GGC: 76851k -> 104252k
    Peak memory use after GGC: 76508k -> 103218k
    Maximum of released memory in single GGC run: 5075k -> 17650k
    Garbage: 92559k -> 391455k
    Leak: 80161k -> 51029k
    Overhead: 9996k -> 35277k
    GGC runs: 306 -> 574

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244755k -> 244757k
    Peak memory use before GGC: 80969k
    Peak memory use after GGC: 58708k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 145362k
    Leak: 7619k
    Overhead: 24814k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245579k -> 245577k
    Peak memory use before GGC: 81615k
    Peak memory use after GGC: 59354k
    Maximum of released memory in single GGC run: 44123k
    Garbage: 145629k
    Leak: 9387k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245883k -> 245975k
    Peak memory use before GGC: 85141k
    Peak memory use after GGC: 74853k
    Maximum of released memory in single GGC run: 36136k
    Garbage: 223655k
    Leak: 20863k
    Overhead: 30547k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 499351k -> 499187k
    Peak memory use before GGC: 79840k
    Peak memory use after GGC: 74854k
    Maximum of released memory in single GGC run: 33434k
    Garbage: 230701k
    Leak: 20953k
    Overhead: 32630k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1189163k -> 1188575k
    Peak memory use before GGC: 201756k
    Peak memory use after GGC: 190218k
    Maximum of released memory in single GGC run: 80703k
    Garbage: 376734k
    Leak: 46318k
    Overhead: 49361k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-23 09:43:07.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-24 01:48:47.000000000 +0000
@@ -1,3 +1,44 @@
+2007-02-23  DJ Delorie  <dj@redhat.com>
+
+	* doc/tm.h (BIGGEST_ALIGNMENT): Clarify the purpose of this macro.
+
+2007-02-23  Mike Stump  <mrs@apple.com>
+
+	* tlink.c (scan_linker_output): Parse linker messages from
+	darwin9's linker better.
+
+2007-02-23  Steve Ellcey  <sje@cup.hp.com>
+
+	PR debug/29614
+	* varpool.c (varpool_assemble_pending_decls):  Set
+	varpool_last_needed_node to null.
+
+2007-02-23  DJ Delorie  <dj@redhat.com>
+
+	* config/i386/i386.c (ix86_data_alignment): Don't specify an
+	alignment bigger than the object file can handle.
+
+2007-02-23  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/30825
+	* config/i386/i386.md (*movdi_1_rex64, zero_extendsidi2_32,
+	zero_extendsidi2_rex64): Penalize MMX register<->memory moves.
+	(*movsf_1): Penalize MMX moves.
+
+2007-02-23  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/bfin.md (doloop_end): Fail for loops that can iterate
+	2^32-1 or more times unless flag_unsafe_loop_optimizations.
+
+	* loop-iv.c (determine_max_iter): Moved in front of its sole user.
+
+2007-02-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* builtins.c (fold_builtin_logb, fold_builtin_significand): New.
+	(fold_builtin_1): Use them.
+	* fold-const.c (tree_expr_nonnegative_warnv_p): Handle
+	BUILT_IN_SIGNIFICAND.
+
 2007-02-23  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/i386/i386.c (bdesc_1arg): Initialize
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-02-22 17:47:09.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-02-24 01:48:46.000000000 +0000
@@ -1,3 +1,8 @@
+2007-02-23  Richard Guenther  <rguenther@suse.de>
+
+	* class.c (note_name_declared_in_class): Make declaration
+	changes meaning a pedwarn.
+
 2007-02-22  Michael Matz  <matz@suse.de>
 
 	PR c++/29433


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