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

gcctest@suse.de gcctest@suse.de
Thu Feb 22 19:37: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: 7511k
    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: 7519k
    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: 7519k
    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:
    Overall memory needed: 19895k -> 19891k
    Peak memory use before GGC: 10887k
    Peak memory use after GGC: 10519k
    Maximum of released memory in single GGC run: 2355k
    Garbage: 37710k
    Leak: 9464k
    Overhead: 5741k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35299k -> 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: 37591k -> 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:
    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
    Leak: 11279k
    Overhead: 17195k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147615k -> 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: 193227k -> 191863k
    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: 193187k -> 191815k
    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:
  Ovarall memory allocated via mmap and sbrk decreased from 148351k to 127583k, overall -16.28%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 90646k to 76762k, overall -18.09%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 89748k to 76372k, overall -17.51%
  Amount of produced GGC garbage decreased from 209329k to 91497k, overall -128.78%
  Amount of memory still referenced at the end of compilation increased from 49218k to 79975k, overall 62.49%
    Overall memory needed: 148351k -> 127583k
    Peak memory use before GGC: 90646k -> 76762k
    Peak memory use after GGC: 89748k -> 76372k
    Maximum of released memory in single GGC run: 18005k -> 4944k
    Garbage: 209329k -> 91497k
    Leak: 49218k -> 79975k
    Overhead: 23532k -> 9886k
    GGC runs: 413 -> 304

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
  Ovarall memory allocated via mmap and sbrk decreased from 166687k to 131159k, overall -27.09%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 103574k to 79573k, overall -30.16%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 102548k to 79138k, overall -29.58%
  Amount of produced GGC garbage decreased from 215935k to 91561k, overall -135.84%
  Amount of memory still referenced at the end of compilation increased from 72643k to 83277k, overall 14.64%
    Overall memory needed: 166687k -> 131159k
    Peak memory use before GGC: 103574k -> 79573k
    Peak memory use after GGC: 102548k -> 79138k
    Maximum of released memory in single GGC run: 18487k -> 4943k
    Garbage: 215935k -> 91561k
    Leak: 72643k -> 83277k
    Overhead: 29453k -> 10544k
    GGC runs: 385 -> 297

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Ovarall memory allocated via mmap and sbrk decreased from 142187k to 84395k, overall -68.48%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 101989k to 75864k, overall -34.44%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 100966k to 75556k, overall -33.63%
  Amount of produced GGC garbage decreased from 345386k to 91506k, overall -277.44%
  Amount of memory still referenced at the end of compilation increased from 49931k to 79159k, overall 58.54%
    Overall memory needed: 142187k -> 84395k
    Peak memory use before GGC: 101989k -> 75864k
    Peak memory use after GGC: 100966k -> 75556k
    Maximum of released memory in single GGC run: 17236k -> 4943k
    Garbage: 345386k -> 91506k
    Leak: 49931k -> 79159k
    Overhead: 30022k -> 9886k
    GGC runs: 528 -> 305

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Ovarall memory allocated via mmap and sbrk decreased from 144315k to 84391k, overall -71.01%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 102664k to 75861k, overall -35.33%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 101611k to 75550k, overall -34.50%
  Amount of produced GGC garbage decreased from 374190k to 91508k, overall -308.91%
  Amount of memory still referenced at the end of compilation increased from 50534k to 79153k, overall 56.63%
    Overall memory needed: 144315k -> 84391k
    Peak memory use before GGC: 102664k -> 75861k
    Peak memory use after GGC: 101611k -> 75550k
    Maximum of released memory in single GGC run: 17234k -> 4944k
    Garbage: 374190k -> 91508k
    Leak: 50534k -> 79153k
    Overhead: 33943k -> 9886k
    GGC runs: 562 -> 305

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 146915k to 85139k, overall -72.56%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 104418k to 76851k, overall -35.87%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 103384k to 76508k, overall -35.13%
  Amount of produced GGC garbage decreased from 391435k to 92559k, overall -322.90%
  Amount of memory still referenced at the end of compilation increased from 51195k to 80161k, overall 56.58%
    Overall memory needed: 146915k -> 85139k
    Peak memory use before GGC: 104418k -> 76851k
    Peak memory use after GGC: 103384k -> 76508k
    Maximum of released memory in single GGC run: 17650k -> 5075k
    Garbage: 391435k -> 92559k
    Leak: 51195k -> 80161k
    Overhead: 35274k -> 9996k
    GGC runs: 573 -> 306

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244755k -> 244759k
    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: 245583k -> 245579k
    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: 245975k -> 246087k
    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: 499287k -> 499095k
    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: 1189119k -> 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-22 01:38:33.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-22 17:47:09.000000000 +0000
@@ -1,3 +1,33 @@
+2007-02-22  Michael Matz  <matz@suse.de
+
+	PR c++/29433
+	* dwarf2out.c (add_AT_string): Call ggc_strdup once per string.
+	(type_tag): Use lang_hooks.dwarf_name instead of DECL_NAME.
+
+2007-02-22  Ian Lance Taylor  <iant@google.com>
+
+	PR debug/30898
+	* dwarf2out.c (concatn_mem_loc_descriptor): New static function.
+	(mem_loc_descriptor): Call it.
+
+2007-02-22  Zdenek Dvorak  <dvorakz@suse.cz>
+	    Ira Rosen  <irar@il.ibm.com>
+
+	* tree-data-ref.c (ptr_ptr_may_alias_p): Take alias sets into account.
+
+2007-02-22  Ira Rosen  <irar@il.ibm.com>
+
+	PR tree-optimization/30843
+	* tree-vect-transform.c (vect_transform_loop): Remove strided scalar 
+	stores only after all the group is vectorized.
+
+2007-02-22  Dorit Nuzman  <dorit@il.ibm.com>
+
+	PR tree-optimization/30858
+	* tree-vectorizer.c (vect_is_simple_reduction): Check that the stmts
+	in the reduction cycle have a single use in the loop.
+	* tree-vectorizer.h (relevant): Add documentation.
+
 2007-02-20  Mike Stump  <mrs@apple.com>
 
 	* configure.ac (powerpc*-*-darwin*): #include <sys/cdefs.h>.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-02-20 17:17:40.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-02-22 17:47:09.000000000 +0000
@@ -1,3 +1,16 @@
+2007-02-22  Michael Matz  <matz@suse.de>
+
+	PR c++/29433
+	* cp-tree.h (TFF_UNQUALIFIED_NAME): New formatting flag.
+	* error.c (dump_aggr_type, dump_simple_decl, dump_decl,
+	dump_function_decl): Guard emitting outer scopes by new flag.
+	* cp-lang.c (cxx_dwarf_name): New function.
+	(LANG_HOOKS_DWARF_NAME): Define to cxx_dwarf_name.
+	* pt.c (classtype_mangled_name, mangle_class_name_for_template):
+	Remove functions.
+	(push_template_decl_real, lookup_template_class): Remove calls
+	to above functions.
+
 2007-02-19  Mark Mitchell  <mark@codesourcery.com>
 
 	* call.c (build_new_method_call): Ensure that explicit calls of


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