A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Tue Mar 20 21:59: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: 7381k
    Peak memory use before GGC: 2260k
    Peak memory use after GGC: 1949k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2283k
    Overhead: 456k
    GGC runs: 3

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

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

comparing empty function compilation at -O2 level:
    Overall memory needed: 7517k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k -> 455k
    Leak: 2286k
    Overhead: 457k -> 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7517k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k -> 455k
    Leak: 2286k
    Overhead: 457k -> 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17721k -> 17725k
    Peak memory use before GGC: 9262k
    Peak memory use after GGC: 8849k
    Maximum of released memory in single GGC run: 2578k
    Garbage: 37152k
    Leak: 6578k
    Overhead: 5053k
    GGC runs: 282

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19861k
    Peak memory use before GGC: 10877k
    Peak memory use after GGC: 10509k
    Maximum of released memory in single GGC run: 2351k
    Garbage: 37718k
    Leak: 9471k
    Overhead: 5759k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35261k -> 35265k
    Peak memory use before GGC: 19331k
    Peak memory use after GGC: 19125k
    Maximum of released memory in single GGC run: 2177k
    Garbage: 56861k
    Leak: 6607k
    Overhead: 6313k
    GGC runs: 353

comparing combine.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 37585k to 38373k, overall 2.10%
  Amount of produced GGC garbage increased from 69274k to 69368k, overall 0.14%
    Overall memory needed: 37585k -> 38373k
    Peak memory use before GGC: 19371k -> 19369k
    Peak memory use after GGC: 19177k
    Maximum of released memory in single GGC run: 2170k
    Garbage: 69274k -> 69368k
    Leak: 6739k
    Overhead: 8155k -> 8173k
    GGC runs: 406

comparing combine.c compilation at -O3 level:
  Amount of produced GGC garbage increased from 90724k to 90873k, overall 0.16%
  Amount of memory still referenced at the end of compilation increased from 6841k to 6849k, overall 0.12%
    Overall memory needed: 42681k -> 42677k
    Peak memory use before GGC: 19559k
    Peak memory use after GGC: 19263k
    Maximum of released memory in single GGC run: 3644k
    Garbage: 90724k -> 90873k
    Leak: 6841k -> 6849k
    Overhead: 11158k -> 11193k
    GGC runs: 429 -> 430

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 102969k -> 102965k
    Peak memory use before GGC: 68624k
    Peak memory use after GGC: 44728k
    Maximum of released memory in single GGC run: 36429k
    Garbage: 131233k
    Leak: 9581k
    Overhead: 16927k
    GGC runs: 212

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104201k
    Peak memory use before GGC: 69786k
    Peak memory use after GGC: 45996k
    Maximum of released memory in single GGC run: 36430k
    Garbage: 132452k
    Leak: 11289k
    Overhead: 17324k
    GGC runs: 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147585k -> 145965k
    Peak memory use before GGC: 85946k
    Peak memory use after GGC: 80068k
    Maximum of released memory in single GGC run: 32842k
    Garbage: 265258k
    Leak: 9401k
    Overhead: 27688k
    GGC runs: 227

comparing insn-attrtab.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 193409k to 208525k, overall 7.82%
    Overall memory needed: 193409k -> 208525k
    Peak memory use before GGC: 87233k
    Peak memory use after GGC: 80138k
    Maximum of released memory in single GGC run: 30051k
    Garbage: 301513k -> 301581k
    Leak: 9399k
    Overhead: 33341k -> 33355k
    GGC runs: 248

comparing insn-attrtab.c compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 193469k to 199577k, overall 3.16%
    Overall memory needed: 193469k -> 199577k
    Peak memory use before GGC: 87247k
    Peak memory use after GGC: 80152k
    Maximum of released memory in single GGC run: 30112k
    Garbage: 302169k -> 302242k
    Leak: 9404k
    Overhead: 33541k -> 33556k
    GGC runs: 247

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147348k
    Peak memory use before GGC: 90241k
    Peak memory use after GGC: 89347k
    Maximum of released memory in single GGC run: 17774k
    Garbage: 208227k
    Leak: 49207k
    Overhead: 23914k
    GGC runs: 411

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 165180k
    Peak memory use before GGC: 102847k
    Peak memory use after GGC: 101829k
    Maximum of released memory in single GGC run: 18128k
    Garbage: 214756k
    Leak: 72521k
    Overhead: 29811k
    GGC runs: 385

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 141832k
    Peak memory use before GGC: 101813k
    Peak memory use after GGC: 100801k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 344933k
    Leak: 49940k
    Overhead: 30478k
    GGC runs: 528

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 143704k -> 143956k
    Peak memory use before GGC: 102422k
    Peak memory use after GGC: 101406k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 376439k -> 376559k
    Leak: 51028k -> 51028k
    Overhead: 34794k -> 34807k
    GGC runs: 566

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 146176k
    Peak memory use before GGC: 104269k -> 104268k
    Peak memory use after GGC: 103221k
    Maximum of released memory in single GGC run: 17610k
    Garbage: 395577k -> 395734k
    Leak: 51314k -> 51314k
    Overhead: 36399k -> 36414k
    GGC runs: 574

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244573k
    Peak memory use before GGC: 80960k
    Peak memory use after GGC: 58699k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 144344k
    Leak: 7611k
    Overhead: 24815k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245409k
    Peak memory use before GGC: 81606k
    Peak memory use after GGC: 59345k
    Maximum of released memory in single GGC run: 44122k
    Garbage: 144515k
    Leak: 9378k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245201k
    Peak memory use before GGC: 85157k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 36137k
    Garbage: 222621k
    Leak: 20854k
    Overhead: 30548k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 498565k
    Peak memory use before GGC: 79831k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 33438k
    Garbage: 229668k -> 229670k
    Leak: 20944k
    Overhead: 32630k -> 32630k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
  Overall memory allocated via mmap and sbrk increased from 1215421k to 1478589k, overall 21.65%
    Overall memory needed: 1215421k -> 1478589k
    Peak memory use before GGC: 201747k
    Peak memory use after GGC: 190209k
    Maximum of released memory in single GGC run: 80686k -> 80687k
    Garbage: 363594k -> 363596k
    Leak: 46310k
    Overhead: 46513k -> 46513k
    GGC runs: 71

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-03-20 03:40:07.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-03-20 19:48:52.000000000 +0000
@@ -1,3 +1,36 @@
+2007-03-20  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* config/vxlib.c (tls_delete_hook): Use TCB for kernel tasks.
+
+2007-03-19  Andrew Haley  <aph@redhat.com>
+
+	PR tree-optimization/31264
+	* tree-vrp.c (register_edge_assert_for_1): Don't look though
+	VIEW_CONVERT_EXPRs.
+
+2007-03-19  Paolo Bonzini  <bonzini@gnu.org>
+
+	PR rtl-optimization/30907
+	* fwprop.c (forward_propagate_into): Never propagate inside a loop.
+	(fwprop_init): Always call loop_optimizer_initialize.
+	(fwprop_done): Always call loop_optimizer_finalize.
+	(fwprop): We always have loop info now.
+	(gate_fwprop_addr): Remove.
+	(pass_fwprop_addr): Use gate_fwprop as gate.
+
+	PR rtl-optimization/30841
+	* df-problems.c (df_ru_local_compute, df_rd_local_compute,
+	df_chain_alloc): Call df_reorganize_refs unconditionally.
+	* df-scan.c (df_rescan_blocks, df_reorganize_refs): Change
+	refs_organized to refs_organized_size.
+	(df_ref_create_structure): Use refs_organized_size instead of
+	bitmap_size if refs had been organized, and keep refs_organized_size
+	up-to-date.
+	* df.h (struct df_ref_info): Change refs_organized to
+	refs_organized_size.
+	(DF_DEFS_SIZE, DF_USES_SIZE): Use refs_organized_size instead of
+	bitmap_size.
+
 2007-03-19  Mark Mitchell  <mark@codesourcery.com>
 
 	* except.c (output_function_exception_table): Do not reference the


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