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

gcctest@suse.de gcctest@suse.de
Thu Jan 25 03:05: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: 7380k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 309k
    Garbage: 444k
    Leak: 2289k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7396k
    Peak memory use before GGC: 2292k
    Peak memory use after GGC: 1982k
    Maximum of released memory in single GGC run: 310k
    Garbage: 447k
    Leak: 2321k
    Overhead: 460k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7492k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 309k
    Garbage: 451k
    Leak: 2291k
    Overhead: 456k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7504k
    Peak memory use before GGC: 2265k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 310k
    Garbage: 454k
    Leak: 2291k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7504k
    Peak memory use before GGC: 2265k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 310k
    Garbage: 454k
    Leak: 2291k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17620k -> 17616k
    Peak memory use before GGC: 9322k
    Peak memory use after GGC: 8885k
    Maximum of released memory in single GGC run: 2627k
    Garbage: 37251k
    Leak: 6539k
    Overhead: 4643k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19704k
    Peak memory use before GGC: 10916k
    Peak memory use after GGC: 10545k
    Maximum of released memory in single GGC run: 2388k
    Garbage: 37851k
    Leak: 9415k
    Overhead: 5346k
    GGC runs: 271

comparing combine.c compilation at -O1 level:
    Overall memory needed: 33000k
    Peak memory use before GGC: 19645k
    Peak memory use after GGC: 19446k
    Maximum of released memory in single GGC run: 2261k
    Garbage: 54612k
    Leak: 6569k
    Overhead: 9667k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 36512k
    Peak memory use before GGC: 19650k
    Peak memory use after GGC: 19454k
    Maximum of released memory in single GGC run: 2203k
    Garbage: 70393k
    Leak: 6681k
    Overhead: 11478k
    GGC runs: 410

comparing combine.c compilation at -O3 level:
    Overall memory needed: 47452k
    Peak memory use before GGC: 20775k
    Peak memory use after GGC: 19929k
    Maximum of released memory in single GGC run: 3163k
    Garbage: 103575k
    Leak: 6763k
    Overhead: 16318k
    GGC runs: 462

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 104736k
    Peak memory use before GGC: 70357k
    Peak memory use after GGC: 45189k
    Maximum of released memory in single GGC run: 37701k
    Garbage: 131189k
    Leak: 9580k
    Overhead: 15666k
    GGC runs: 208

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 106120k
    Peak memory use before GGC: 71519k
    Peak memory use after GGC: 46457k
    Maximum of released memory in single GGC run: 37702k
    Garbage: 132350k
    Leak: 11270k
    Overhead: 16060k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 123872k -> 123876k
    Peak memory use before GGC: 71508k
    Peak memory use after GGC: 67853k
    Maximum of released memory in single GGC run: 31661k
    Garbage: 227099k
    Leak: 9400k
    Overhead: 28095k
    GGC runs: 224

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 192136k
    Peak memory use before GGC: 78337k
    Peak memory use after GGC: 72716k
    Maximum of released memory in single GGC run: 30526k
    Garbage: 278147k
    Leak: 9397k
    Overhead: 34350k
    GGC runs: 246

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 192140k -> 192136k
    Peak memory use before GGC: 78349k
    Peak memory use after GGC: 72729k
    Maximum of released memory in single GGC run: 30596k
    Garbage: 278874k
    Leak: 9399k
    Overhead: 34560k
    GGC runs: 246

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 151620k -> 151628k
    Peak memory use before GGC: 92618k
    Peak memory use after GGC: 91701k
    Maximum of released memory in single GGC run: 18916k
    Garbage: 209166k
    Leak: 49262k
    Overhead: 21473k
    GGC runs: 409

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 169728k
    Peak memory use before GGC: 105241k
    Peak memory use after GGC: 104198k
    Maximum of released memory in single GGC run: 19093k
    Garbage: 215792k
    Leak: 72687k
    Overhead: 27396k
    GGC runs: 383

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 98467k to 99218k, overall 0.76%
  Peak amount of GGC memory still allocated after garbage collectin increased from 97465k to 98235k, overall 0.79%
  Amount of produced GGC garbage increased from 401725k to 437485k, overall 8.90%
  Amount of memory still referenced at the end of compilation increased from 50201k to 50849k, overall 1.29%
    Overall memory needed: 138168k -> 137348k
    Peak memory use before GGC: 98467k -> 99218k
    Peak memory use after GGC: 97465k -> 98235k
    Maximum of released memory in single GGC run: 18086k
    Garbage: 401725k -> 437485k
    Leak: 50201k -> 50849k
    Overhead: 55441k -> 62412k
    GGC runs: 545 -> 575

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 98507k to 99295k, overall 0.80%
  Peak amount of GGC memory still allocated after garbage collectin increased from 97531k to 98301k, overall 0.79%
  Amount of produced GGC garbage increased from 459405k to 509752k, overall 10.96%
  Amount of memory still referenced at the end of compilation increased from 50999k to 51734k, overall 1.44%
    Overall memory needed: 140124k -> 139200k
    Peak memory use before GGC: 98507k -> 99295k
    Peak memory use after GGC: 97531k -> 98301k
    Maximum of released memory in single GGC run: 18077k
    Garbage: 459405k -> 509752k
    Leak: 50999k -> 51734k
    Overhead: 48441k -> 55642k
    GGC runs: 596 -> 638

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage decreased from 486910k to 291162k, overall -67.23%
  Amount of memory still referenced at the end of compilation increased from 51670k to 52086k, overall 0.80%
    Overall memory needed: 142864k -> 141860k
    Peak memory use before GGC: 100217k -> 98659k
    Peak memory use after GGC: 99219k -> 97682k
    Maximum of released memory in single GGC run: 18473k
    Garbage: 486910k -> 291162k
    Leak: 51670k -> 52086k
    Overhead: 50444k -> 27133k
    GGC runs: 613 -> 494

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 246456k
    Peak memory use before GGC: 82632k
    Peak memory use after GGC: 59512k
    Maximum of released memory in single GGC run: 45582k
    Garbage: 148107k
    Leak: 8083k
    Overhead: 24863k
    GGC runs: 80

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 247352k
    Peak memory use before GGC: 83278k
    Peak memory use after GGC: 60158k
    Maximum of released memory in single GGC run: 45231k
    Garbage: 148382k
    Leak: 9338k
    Overhead: 25359k
    GGC runs: 88

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 312392k to 329208k, overall 5.38%
  Peak amount of GGC memory allocated before garbage collecting increased from 196150k to 215829k, overall 10.03%
  Peak amount of GGC memory still allocated after garbage collectin increased from 176842k to 207547k, overall 17.36%
  Amount of produced GGC garbage increased from 270689k to 290574k, overall 7.35%
  Amount of memory still referenced at the end of compilation increased from 28013k to 32943k, overall 17.60%
    Overall memory needed: 312392k -> 329208k
    Peak memory use before GGC: 196150k -> 215829k
    Peak memory use after GGC: 176842k -> 207547k
    Maximum of released memory in single GGC run: 132332k -> 140082k
    Garbage: 270689k -> 290574k
    Leak: 28013k -> 32943k
    Overhead: 32272k -> 32591k
    GGC runs: 74

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 302731k to 365845k, overall 20.85%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 176836k to 119689k, overall -47.75%
  Amount of produced GGC garbage increased from 583241k to 616505k, overall 5.70%
  Amount of memory still referenced at the end of compilation decreased from 28442k to 13413k, overall -112.04%
    Overall memory needed: 297880k -> 303620k
    Peak memory use before GGC: 302731k -> 365845k
    Peak memory use after GGC: 176836k -> 119689k
    Maximum of released memory in single GGC run: 241048k -> 306846k
    Garbage: 583241k -> 616505k
    Leak: 28442k -> 13413k
    Overhead: 94442k -> 106831k
    GGC runs: 83 -> 102

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1412088k -> 1412064k
    Peak memory use before GGC: 280855k
    Peak memory use after GGC: 273873k
    Maximum of released memory in single GGC run: 114236k
    Garbage: 446260k
    Leak: 50427k
    Overhead: 55164k
    GGC runs: 74

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-01-24 21:52:11.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-01-25 01:08:12.000000000 +0000
@@ -1,5 +1,22 @@
+2007-01-24  Jan Hubicka  <jh@suse.cz>
+
+	* ipa-inline.c (initial_insns, max_insns): Delete.
+	(compute_max_insns): New function.
+	(cgraph_decide_inlining_of_small_function): Use it; take minimal amount
+	of insns as base for code growth.
+	(cgraph_decide_inlining): Make initial_insns local; do not compute
+	max_insns.
+	* params.def (PARAM_INLINE_UNIT_GROWTH): Set to 60.
+	* doc/invoke.texi (inline-unit-growth): Update docs.
+
 2007-01-24  Jakub Jelinek  <jakub@redhat.com>
 
+	* config/i386/i386.h (x86_cmpxchg16b): Remove const.
+	(TARGET_CMPXCHG16B): Define to x86_cmpxchg16b.
+	* config/i386/i386.c (x86_cmpxchg16b): Remove const.
+	(override_options): Add PTA_CX16 flag.  Set x86_cmpxchg16b
+	for CPUs that have PTA_CX16 set.
+
 	PR middle-end/27416
 	* gimplify.c (omp_check_private): New function.
 	(gimplify_scan_omp_clauses): Use it for


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