A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Fri May 18 07:11: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:
  Peak amount of GGC memory allocated before garbage collecting increased from 2334k to 2340k, overall 0.26%
  Peak amount of GGC memory still allocated after garbage collecting increased from 2007k to 2012k, overall 0.25%
  Amount of produced GGC garbage increased from 480k to 481k, overall 0.18%
  Amount of memory still referenced at the end of compilation increased from 2385k to 2390k, overall 0.22%
    Overall memory needed: 7410k -> 7413k
    Peak memory use before GGC: 2334k -> 2340k
    Peak memory use after GGC: 2007k -> 2012k
    Maximum of released memory in single GGC run: 327k -> 328k
    Garbage: 480k -> 481k
    Leak: 2385k -> 2390k
    Overhead: 518k -> 519k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2362k to 2367k, overall 0.21%
  Peak amount of GGC memory still allocated after garbage collecting increased from 2034k to 2040k, overall 0.29%
  Amount of produced GGC garbage increased from 482k to 483k, overall 0.17%
  Amount of memory still referenced at the end of compilation increased from 2418k to 2423k, overall 0.22%
    Overall memory needed: 7426k -> 7429k
    Peak memory use before GGC: 2362k -> 2367k
    Peak memory use after GGC: 2034k -> 2040k
    Maximum of released memory in single GGC run: 328k -> 327k
    Garbage: 482k -> 483k
    Leak: 2418k -> 2423k
    Overhead: 523k -> 523k
    GGC runs: 3

comparing empty function compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2334k to 2340k, overall 0.26%
  Peak amount of GGC memory still allocated after garbage collecting increased from 2007k to 2012k, overall 0.25%
  Amount of produced GGC garbage increased from 485k to 486k, overall 0.17%
  Amount of memory still referenced at the end of compilation increased from 2387k to 2393k, overall 0.22%
    Overall memory needed: 7518k -> 7517k
    Peak memory use before GGC: 2334k -> 2340k
    Peak memory use after GGC: 2007k -> 2012k
    Maximum of released memory in single GGC run: 327k -> 328k
    Garbage: 485k -> 486k
    Leak: 2387k -> 2393k
    Overhead: 519k -> 519k
    GGC runs: 3

comparing empty function compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2335k to 2340k, overall 0.21%
  Peak amount of GGC memory still allocated after garbage collecting increased from 2007k to 2012k, overall 0.25%
  Amount of produced GGC garbage increased from 489k to 490k, overall 0.16%
  Amount of memory still referenced at the end of compilation increased from 2388k to 2393k, overall 0.22%
    Overall memory needed: 7526k -> 7525k
    Peak memory use before GGC: 2335k -> 2340k
    Peak memory use after GGC: 2007k -> 2012k
    Maximum of released memory in single GGC run: 328k
    Garbage: 489k -> 490k
    Leak: 2388k -> 2393k
    Overhead: 519k -> 520k
    GGC runs: 4

comparing empty function compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2335k to 2340k, overall 0.21%
  Peak amount of GGC memory still allocated after garbage collecting increased from 2007k to 2012k, overall 0.25%
  Amount of produced GGC garbage increased from 489k to 490k, overall 0.16%
  Amount of memory still referenced at the end of compilation increased from 2388k to 2393k, overall 0.22%
    Overall memory needed: 7526k -> 7525k
    Peak memory use before GGC: 2335k -> 2340k
    Peak memory use after GGC: 2007k -> 2012k
    Maximum of released memory in single GGC run: 328k
    Garbage: 489k -> 490k
    Leak: 2388k -> 2393k
    Overhead: 519k -> 520k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
  Amount of produced GGC garbage increased from 37649k to 37690k, overall 0.11%
    Overall memory needed: 17682k -> 17681k
    Peak memory use before GGC: 9025k -> 9030k
    Peak memory use after GGC: 8265k -> 8270k
    Maximum of released memory in single GGC run: 1874k
    Garbage: 37649k -> 37690k
    Leak: 7011k -> 7016k
    Overhead: 4753k -> 4753k
    GGC runs: 278 -> 279

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19578k -> 19585k
    Peak memory use before GGC: 10760k -> 10766k
    Peak memory use after GGC: 9984k -> 9990k
    Maximum of released memory in single GGC run: 1558k
    Garbage: 38018k -> 38007k
    Leak: 9903k -> 9909k
    Overhead: 5459k -> 5459k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 30010k -> 30013k
    Peak memory use before GGC: 17863k -> 17868k
    Peak memory use after GGC: 17665k -> 17670k
    Maximum of released memory in single GGC run: 1454k
    Garbage: 52599k -> 52609k
    Leak: 7063k -> 7068k
    Overhead: 5931k -> 5934k
    GGC runs: 357

comparing combine.c compilation at -O2 level:
    Overall memory needed: 34414k -> 34417k
    Peak memory use before GGC: 17891k -> 17896k
    Peak memory use after GGC: 17679k -> 17684k
    Maximum of released memory in single GGC run: 1368k -> 1367k
    Garbage: 69719k -> 69771k
    Leak: 7178k -> 7184k
    Overhead: 8062k -> 8070k
    GGC runs: 415

comparing combine.c compilation at -O3 level:
  Amount of memory still referenced at the end of compilation increased from 7285k to 7298k, overall 0.18%
    Overall memory needed: 40750k -> 40749k
    Peak memory use before GGC: 18109k -> 18114k
    Peak memory use after GGC: 17883k -> 17888k
    Maximum of released memory in single GGC run: 3637k
    Garbage: 95405k -> 95452k
    Leak: 7285k -> 7298k
    Overhead: 11329k -> 11341k
    GGC runs: 447 -> 449

comparing insn-attrtab.c compilation at -O0 level:
  Amount of memory still referenced at the end of compilation increased from 9607k to 9852k, overall 2.55%
    Overall memory needed: 92882k -> 92897k
    Peak memory use before GGC: 58845k -> 58851k
    Peak memory use after GGC: 33341k -> 33346k
    Maximum of released memory in single GGC run: 33674k -> 33675k
    Garbage: 129385k -> 129130k
    Leak: 9607k -> 9852k
    Overhead: 13889k -> 13890k
    GGC runs: 216

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 94150k -> 94173k
    Peak memory use before GGC: 60007k -> 60013k
    Peak memory use after GGC: 34502k -> 34507k
    Maximum of released memory in single GGC run: 33675k -> 33676k
    Garbage: 129348k -> 129352k
    Leak: 11556k -> 11561k
    Overhead: 14287k -> 14287k
    GGC runs: 211

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 107726k -> 107797k
    Peak memory use before GGC: 62277k -> 62282k
    Peak memory use after GGC: 59776k -> 59781k
    Maximum of released memory in single GGC run: 24268k
    Garbage: 227713k -> 227833k
    Leak: 9735k -> 9740k
    Overhead: 25391k -> 25416k
    GGC runs: 246 -> 245

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 165762k -> 165777k
    Peak memory use before GGC: 62706k -> 62710k
    Peak memory use after GGC: 60102k -> 60106k
    Maximum of released memory in single GGC run: 20519k
    Garbage: 263657k -> 263776k
    Leak: 9726k -> 9731k
    Overhead: 30976k -> 31000k
    GGC runs: 267 -> 266

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 180774k -> 180805k
    Peak memory use before GGC: 75338k -> 75342k
    Peak memory use after GGC: 70907k -> 70912k
    Maximum of released memory in single GGC run: 22137k
    Garbage: 292829k -> 292948k
    Leak: 9730k -> 9735k
    Overhead: 32697k -> 32721k
    GGC runs: 267 -> 266

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 145853k -> 145879k
    Peak memory use before GGC: 89190k -> 89198k
    Peak memory use after GGC: 88307k -> 88315k
    Maximum of released memory in single GGC run: 18130k
    Garbage: 206715k -> 206722k
    Leak: 51188k -> 51196k
    Overhead: 23433k -> 23434k
    GGC runs: 408

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 163569k -> 163575k
    Peak memory use before GGC: 101746k -> 101755k
    Peak memory use after GGC: 100738k -> 100747k
    Maximum of released memory in single GGC run: 18434k
    Garbage: 212400k -> 212402k
    Leak: 74502k -> 74511k
    Overhead: 29330k -> 29330k
    GGC runs: 381

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 141721k -> 141791k
    Peak memory use before GGC: 100956k -> 100961k
    Peak memory use after GGC: 99956k -> 99962k
    Maximum of released memory in single GGC run: 17471k
    Garbage: 343553k -> 343589k
    Leak: 51782k -> 51791k
    Overhead: 30699k -> 30707k
    GGC runs: 530

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 147205k -> 147231k
    Peak memory use before GGC: 101412k
    Peak memory use after GGC: 100402k -> 100401k
    Maximum of released memory in single GGC run: 17468k
    Garbage: 391480k -> 391534k
    Leak: 52898k -> 52907k
    Overhead: 36263k -> 36274k
    GGC runs: 581

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 149561k -> 149591k
    Peak memory use before GGC: 103006k -> 103017k
    Peak memory use after GGC: 101981k -> 101989k
    Maximum of released memory in single GGC run: 17872k -> 17871k
    Garbage: 426078k -> 426097k
    Leak: 53207k -> 53215k
    Overhead: 38917k -> 38923k
    GGC runs: 605 -> 604

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244578k -> 244625k
    Peak memory use before GGC: 81028k -> 81032k
    Peak memory use after GGC: 58767k -> 58771k
    Maximum of released memory in single GGC run: 44134k
    Garbage: 144417k -> 144419k
    Leak: 7735k -> 7739k
    Overhead: 23301k -> 23302k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245402k -> 245405k
    Peak memory use before GGC: 81674k -> 81678k
    Peak memory use after GGC: 59413k -> 59417k
    Maximum of released memory in single GGC run: 44123k
    Garbage: 144534k -> 144536k
    Leak: 9503k -> 9507k
    Overhead: 23797k -> 23798k
    GGC runs: 87

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 243930k -> 243893k
    Peak memory use before GGC: 83514k
    Peak memory use after GGC: 74909k -> 74913k
    Maximum of released memory in single GGC run: 39406k -> 39403k
    Garbage: 222953k -> 222960k
    Leak: 20978k -> 20982k
    Overhead: 29139k -> 29140k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 264214k -> 264245k
    Peak memory use before GGC: 79895k -> 79899k
    Peak memory use after GGC: 74909k -> 74913k
    Maximum of released memory in single GGC run: 33018k -> 33013k
    Garbage: 229676k -> 229674k
    Leak: 21068k -> 21072k
    Overhead: 31163k -> 31164k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
  Amount of produced GGC garbage increased from 362940k to 363313k, overall 0.10%
    Overall memory needed: 1297770k -> 1297725k
    Peak memory use before GGC: 190668k -> 190671k
    Peak memory use after GGC: 178184k -> 178187k
    Maximum of released memory in single GGC run: 80664k -> 80665k
    Garbage: 362940k -> 363313k
    Leak: 46435k -> 46439k
    Overhead: 43819k -> 43894k
    GGC runs: 72

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-05-17 13:23:54.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-05-18 05:10:01.000000000 +0000
@@ -1,3 +1,45 @@
+2007-05-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* toplev.c (print_version): Output GMP/MPFR version info.
+
+	* builtins.c (CASE_MATHFN_REENT): New macro.
+	(mathfn_built_in): Use it.
+	* builtins.def (BUILT_IN_GAMMA_R, BUILT_IN_GAMMAF_R,
+	BUILT_IN_GAMMAL_R, BUILT_IN_LGAMMA_R, BUILT_IN_LGAMMAF_R,
+	BUILT_IN_LGAMMAL_R): New.
+	* doc/extend.texi: Document new builtins.
+
+	PR middle-end/31796
+	* builtins.c (do_mpfr_remquo): New.
+	(fold_builtin_2): Handle BUILT_IN_DREM/BUILT_IN_REMAINDER.
+	(fold_builtin_3): Handle BUILT_IN_REMQUO.
+
+	PR middle-end/30251
+	* builtins.c (fold_builtin_1): Handle y0, y1.
+	(fold_builtin_2): Handle yn.
+
+	PR middle-end/30251
+	* builtins.c (do_mpfr_bessel_n): New.
+	(fold_builtin_1): Handle BUILT_IN_J0 and BUILT_IN_J1.
+	(fold_builtin_2): Handle BUILT_IN_JN.
+
+2007-05-17  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	PR target/31965
+	* config/i386/mingw32.h (_INTEGRAL_MAX_BITS): Define builtin as
+	TYPE_PRECISION (intmax_type_node).
+
+2007-05-17  Steve Ellcey  <sje@cup.hp.com>
+
+	PR target/31850
+	* reload.c (subst_reloads): Remove checking.
+
+2007-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	PR rtl-optimization/31691
+	* combine.c (simplify_set): Build a new src pattern instead of
+	substituting its operands in the COMPARE case.
+
 2007-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
 
 	* tree-vrp.c (finalize_jump_threads): Do not care about dominance info.


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