A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Sun Feb 11 06:14: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 2265k to 2268k, overall 0.13%
  Peak amount of GGC memory still allocated after garbage collecting increased from 1955k to 1957k, overall 0.10%
  Amount of produced GGC garbage increased from 445k to 446k, overall 0.14%
    Overall memory needed: 7384k -> 7385k
    Peak memory use before GGC: 2265k -> 2268k
    Peak memory use after GGC: 1955k -> 1957k
    Maximum of released memory in single GGC run: 310k -> 311k
    Garbage: 445k -> 446k
    Leak: 2289k -> 2291k
    Overhead: 456k -> 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2293k to 2296k, overall 0.13%
  Peak amount of GGC memory still allocated after garbage collecting increased from 1982k to 1985k, overall 0.15%
  Amount of produced GGC garbage increased from 448k to 449k, overall 0.14%
    Overall memory needed: 7400k -> 7401k
    Peak memory use before GGC: 2293k -> 2296k
    Peak memory use after GGC: 1982k -> 1985k
    Maximum of released memory in single GGC run: 311k
    Garbage: 448k -> 449k
    Leak: 2321k -> 2324k
    Overhead: 461k -> 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2265k to 2268k, overall 0.13%
  Peak amount of GGC memory still allocated after garbage collecting increased from 1955k to 1957k, overall 0.10%
  Amount of produced GGC garbage increased from 451k to 452k, overall 0.14%
    Overall memory needed: 7512k -> 7513k
    Peak memory use before GGC: 2265k -> 2268k
    Peak memory use after GGC: 1955k -> 1957k
    Maximum of released memory in single GGC run: 310k -> 311k
    Garbage: 451k -> 452k
    Leak: 2291k -> 2294k
    Overhead: 457k -> 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2266k to 2269k, overall 0.13%
  Peak amount of GGC memory still allocated after garbage collecting increased from 1955k to 1958k, overall 0.15%
  Amount of produced GGC garbage increased from 454k to 455k, overall 0.14%
    Overall memory needed: 7512k -> 7513k
    Peak memory use before GGC: 2266k -> 2269k
    Peak memory use after GGC: 1955k -> 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 454k -> 455k
    Leak: 2291k -> 2294k
    Overhead: 457k -> 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 2266k to 2269k, overall 0.13%
  Peak amount of GGC memory still allocated after garbage collecting increased from 1955k to 1958k, overall 0.15%
  Amount of produced GGC garbage increased from 454k to 455k, overall 0.14%
    Overall memory needed: 7512k -> 7513k
    Peak memory use before GGC: 2266k -> 2269k
    Peak memory use after GGC: 1955k -> 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 454k -> 455k
    Leak: 2291k -> 2294k
    Overhead: 457k -> 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17728k -> 17785k
    Peak memory use before GGC: 9291k -> 9294k
    Peak memory use after GGC: 8871k -> 8873k
    Maximum of released memory in single GGC run: 2603k
    Garbage: 37162k -> 37160k
    Leak: 6539k -> 6541k
    Overhead: 5024k -> 5024k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19824k -> 19821k
    Peak memory use before GGC: 10897k -> 10899k
    Peak memory use after GGC: 10531k -> 10533k
    Maximum of released memory in single GGC run: 2375k
    Garbage: 37738k -> 37749k
    Leak: 9415k -> 9418k
    Overhead: 5727k -> 5727k
    GGC runs: 270

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35176k -> 35185k
    Peak memory use before GGC: 19436k -> 19438k
    Peak memory use after GGC: 19221k -> 19223k
    Maximum of released memory in single GGC run: 2197k
    Garbage: 57494k -> 57476k
    Leak: 6564k -> 6567k
    Overhead: 6358k -> 6356k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37500k -> 37501k
    Peak memory use before GGC: 19471k -> 19473k
    Peak memory use after GGC: 19269k -> 19271k
    Maximum of released memory in single GGC run: 2185k
    Garbage: 68794k -> 68735k
    Leak: 6673k -> 6675k
    Overhead: 7992k -> 7983k
    GGC runs: 405 -> 404

comparing combine.c compilation at -O3 level:
    Overall memory needed: 45720k -> 45729k
    Peak memory use before GGC: 20504k -> 20505k
    Peak memory use after GGC: 19622k -> 19623k
    Maximum of released memory in single GGC run: 3158k
    Garbage: 101168k -> 101110k
    Leak: 6814k -> 6812k
    Overhead: 12209k -> 12212k
    GGC runs: 453 -> 452

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103544k -> 103545k
    Peak memory use before GGC: 69329k -> 69332k
    Peak memory use after GGC: 44976k -> 44978k
    Maximum of released memory in single GGC run: 36886k
    Garbage: 130571k -> 130575k
    Leak: 9588k -> 9591k
    Overhead: 16932k -> 16932k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
  Amount of produced GGC garbage increased from 131730k to 131985k, overall 0.19%
    Overall memory needed: 105068k -> 105065k
    Peak memory use before GGC: 70490k -> 70493k
    Peak memory use after GGC: 46244k -> 46246k
    Maximum of released memory in single GGC run: 36886k -> 36887k
    Garbage: 131730k -> 131985k
    Leak: 11278k -> 11026k
    Overhead: 17326k -> 17326k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 148000k -> 148021k
    Peak memory use before GGC: 86337k -> 86339k
    Peak memory use after GGC: 80544k -> 80546k
    Maximum of released memory in single GGC run: 33048k -> 33049k
    Garbage: 264635k -> 264639k
    Leak: 9405k -> 9407k
    Overhead: 27596k -> 27596k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191528k -> 191389k
    Peak memory use before GGC: 87649k -> 87655k
    Peak memory use after GGC: 80609k -> 80616k
    Maximum of released memory in single GGC run: 31387k -> 31384k
    Garbage: 299498k -> 299486k
    Leak: 9402k -> 9404k
    Overhead: 33191k -> 33191k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 196316k -> 191437k
    Peak memory use before GGC: 87666k -> 87668k
    Peak memory use after GGC: 80627k -> 80629k
    Maximum of released memory in single GGC run: 31450k -> 31447k
    Garbage: 300155k -> 300154k
    Leak: 9407k -> 9409k
    Overhead: 33391k -> 33391k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 151197k -> 151205k
    Peak memory use before GGC: 92317k -> 92319k
    Peak memory use after GGC: 91394k -> 91396k
    Maximum of released memory in single GGC run: 18793k -> 18792k
    Garbage: 210317k -> 210314k
    Leak: 49389k -> 49391k
    Overhead: 23720k -> 23720k
    GGC runs: 411 -> 410

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 169353k -> 169365k
    Peak memory use before GGC: 104950k -> 104952k
    Peak memory use after GGC: 103910k -> 103913k
    Maximum of released memory in single GGC run: 18979k -> 18978k
    Garbage: 216936k -> 216937k
    Leak: 72814k -> 72816k
    Overhead: 29643k -> 29643k
    GGC runs: 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 142270k -> 142287k
    Peak memory use before GGC: 102378k -> 102382k
    Peak memory use after GGC: 101350k -> 101354k
    Maximum of released memory in single GGC run: 17982k
    Garbage: 346698k -> 346720k
    Leak: 50049k -> 50051k
    Overhead: 30234k -> 30239k
    GGC runs: 523

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 142654k -> 142711k
    Peak memory use before GGC: 103057k
    Peak memory use after GGC: 101997k -> 101996k
    Maximum of released memory in single GGC run: 17979k
    Garbage: 375730k -> 375734k
    Leak: 50648k -> 50657k
    Overhead: 34176k -> 34175k
    GGC runs: 560 -> 559

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 145910k -> 145951k
    Peak memory use before GGC: 104814k -> 104821k
    Peak memory use after GGC: 103748k -> 103752k
    Maximum of released memory in single GGC run: 18300k
    Garbage: 392061k -> 392091k
    Leak: 51296k -> 51301k
    Overhead: 35426k -> 35436k
    GGC runs: 570 -> 569

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 245795k -> 245804k
    Peak memory use before GGC: 81775k -> 81778k
    Peak memory use after GGC: 59514k -> 59517k
    Maximum of released memory in single GGC run: 44985k
    Garbage: 145986k -> 145987k
    Leak: 7570k -> 7572k
    Overhead: 24807k -> 24807k
    GGC runs: 80

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 246647k -> 246656k
    Peak memory use before GGC: 82421k -> 82424k
    Peak memory use after GGC: 60160k -> 60163k
    Maximum of released memory in single GGC run: 44974k -> 44975k
    Garbage: 146205k -> 146205k
    Leak: 9338k -> 9340k
    Overhead: 25303k -> 25303k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 240616k -> 240609k
    Peak memory use before GGC: 84340k -> 84342k
    Peak memory use after GGC: 73894k -> 73896k
    Maximum of released memory in single GGC run: 36499k
    Garbage: 224276k -> 224279k
    Leak: 19608k -> 19610k
    Overhead: 30436k -> 30437k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 485972k -> 486113k
    Peak memory use before GGC: 78744k -> 78746k
    Peak memory use after GGC: 73894k -> 73896k
    Maximum of released memory in single GGC run: 33796k
    Garbage: 231677k -> 231678k
    Leak: 19698k -> 19700k
    Overhead: 32578k -> 32579k
    GGC runs: 92

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1180644k -> 1180773k
    Peak memory use before GGC: 200610k -> 200612k
    Peak memory use after GGC: 188951k -> 188954k
    Maximum of released memory in single GGC run: 80732k
    Garbage: 376322k -> 376323k
    Leak: 45252k -> 45254k
    Overhead: 49159k -> 49159k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-10 12:12:58.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-11 04:12:29.000000000 +0000
@@ -1,3 +1,49 @@
+2007-02-10  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+	PR target/30634
+	* pa.md (movdf): For 64-bit target, fail if operand 1 is a non-zero
+	CONST_DOUBLE and operand 0 is a hard register.
+	(movdi): For 64-bit target, remove code to force CONST_DOUBLE to
+	memory.  Fail if operand 1 is a non-zero CONST_INT and operand 0
+	is a hard floating-point register.
+
+2007-02-10  Richard Henderson  <rth@redhat.com>, Jakub Jelinek  <jakub@redhat.com>, Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (libgcc-support, libgcc.mvars): Add emutls.c.
+	* builtin-types.def (BT_WORD): Make unsigned.
+	(BT_FN_VOID_PTR_WORD_WORD_PTR): New.
+	* builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS): New.
+	(BUILT_IN_EMUTLS_REGISTER_COMMON): New.
+	* c-decl.c (grokdeclarator): Don't error if !have_tls.
+	* c-parser.c (c_parser_omp_threadprivate): Likewise.
+	* dwarf2out.c (loc_descriptor_from_tree_1): Don't do anything for
+	emulated tls.
+	* expr.c (emutls_var_address): New.
+	(expand_expr_real_1): Expand emulated tls.
+	(expand_expr_addr_expr_1): Likewise.
+	* libgcc-std.ver: Add __emutls_get_address, __emutls_register_common.
+	* output.h (emutls_finish): Declare.
+	* toplev.c (compile_file): Call it.
+	* tree-ssa-address.c (gen_addr_rtx): Check for const-ness of the
+	address before wrapping in CONST.
+	* varasm.c (emutls_htab, emutls_object_type): New.
+	(EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): New.
+	(get_emutls_object_name, get_emutls_object_type): New.
+	(get_emutls_init_templ_addr, emutls_decl): New.
+	(emutls_common_1, emutls_finish): New.
+	(assemble_variable): When emulating tls, swap decls; generate
+	constructor for the emutls objects.
+	(do_assemble_alias): When emulating tls, swap decl and target name.
+	(default_encode_section_info): Don't add SYMBOL_FLAG_TLS_SHIFT
+	for emulated tls.
+	* varpool.c (decide_is_variable_needed): Look at force_output.
+	Recurse for emulated tls.
+	(cgraph_varpool_remove_unreferenced_decls): Remove checks redundant
+	with decide_is_variable_needed.
+	* emutls.c: New file.
+	* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Only emit
+	tls_object for real tls.
+
 2007-02-10  Kaz Kojima  <kkojima@gcc.gnu.org>
 
 	PR rtl-optimization/29599
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-02-07 22:02:50.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-02-11 04:12:29.000000000 +0000
@@ -1,3 +1,13 @@
+2007-02-10  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+	* parser.c (cp_parser_primary_expression): Reformat overly long lines.
+
+2007-02-10  Richard Henderson  <rth@redhat.com>, Jakub Jelinek  <jakub@redhat.com>
+
+	* decl.c (grokvardecl): Don't error if !have_tls.
+	(grokdeclarator): Likewise.
+	* parser.c (cp_parser_omp_threadprivate): Likewise.
+
 2007-02-07  Jakub Jelinek  <jakub@redhat.com>
 
 	PR c++/30703


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