A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Wed Jan 3 11:43: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: 18329k -> 18333k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 446k -> 444k
    Leak: 2288k -> 2287k
    Overhead: 455k -> 455k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 18345k -> 18349k
    Peak memory use before GGC: 2291k
    Peak memory use after GGC: 1981k
    Maximum of released memory in single GGC run: 310k
    Garbage: 448k -> 447k
    Leak: 2320k -> 2320k
    Overhead: 460k -> 460k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 18437k -> 18445k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 450k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 18449k -> 18457k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 453k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 18449k -> 18457k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1954k
    Maximum of released memory in single GGC run: 310k
    Garbage: 453k
    Leak: 2290k
    Overhead: 456k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 28589k -> 28613k
    Peak memory use before GGC: 9316k -> 9312k
    Peak memory use after GGC: 8864k
    Maximum of released memory in single GGC run: 2609k -> 2606k
    Garbage: 37272k -> 37286k
    Leak: 6539k -> 6539k
    Overhead: 4828k -> 4828k
    GGC runs: 279 -> 276

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 30641k -> 30665k
    Peak memory use before GGC: 10895k
    Peak memory use after GGC: 10524k
    Maximum of released memory in single GGC run: 2365k -> 2366k
    Garbage: 37863k -> 37877k
    Leak: 9415k -> 9414k
    Overhead: 5530k -> 5530k
    GGC runs: 271

comparing combine.c compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 29534k to 33538k, overall 13.56%
  Peak amount of GGC memory allocated before garbage collecting increased from 17025k to 20889k, overall 22.70%
  Peak amount of GGC memory still allocated after garbage collectin increased from 16854k to 20680k, overall 22.70%
  Amount of memory still referenced at the end of compilation increased from 6566k to 7673k, overall 16.86%
    Overall memory needed: 29534k -> 33538k
    Peak memory use before GGC: 17025k -> 20889k
    Peak memory use after GGC: 16854k -> 20680k
    Maximum of released memory in single GGC run: 2219k -> 2163k
    Garbage: 55554k -> 54911k
    Leak: 6566k -> 7673k
    Overhead: 9951k -> 9977k
    GGC runs: 362 -> 345

comparing combine.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 29530k to 33538k, overall 13.57%
  Peak amount of GGC memory allocated before garbage collecting increased from 17027k to 20917k, overall 22.85%
  Peak amount of GGC memory still allocated after garbage collectin increased from 16854k to 20708k, overall 22.87%
  Amount of memory still referenced at the end of compilation increased from 6686k to 7795k, overall 16.59%
    Overall memory needed: 29530k -> 33538k
    Peak memory use before GGC: 17027k -> 20917k
    Peak memory use after GGC: 16854k -> 20708k
    Maximum of released memory in single GGC run: 2299k -> 2347k
    Garbage: 71633k -> 70975k
    Leak: 6686k -> 7795k
    Overhead: 11920k -> 11943k
    GGC runs: 412 -> 399

comparing combine.c compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 28650k to 32766k, overall 14.37%
  Peak amount of GGC memory allocated before garbage collecting increased from 18122k to 22012k, overall 21.47%
  Peak amount of GGC memory still allocated after garbage collectin increased from 17653k to 21429k, overall 21.39%
  Amount of memory still referenced at the end of compilation increased from 6768k to 7505k, overall 10.88%
    Overall memory needed: 28650k -> 32766k
    Peak memory use before GGC: 18122k -> 22012k
    Peak memory use after GGC: 17653k -> 21429k
    Maximum of released memory in single GGC run: 3658k -> 3788k
    Garbage: 105772k -> 104639k
    Leak: 6768k -> 7505k
    Overhead: 16805k -> 16617k
    GGC runs: 463 -> 452

comparing insn-attrtab.c compilation at -O0 level:
  Amount of produced GGC garbage increased from 130549k to 131554k, overall 0.77%
    Overall memory needed: 89194k
    Peak memory use before GGC: 70732k -> 70731k
    Peak memory use after GGC: 44750k -> 44749k
    Maximum of released memory in single GGC run: 37356k -> 37355k
    Garbage: 130549k -> 131554k
    Leak: 9580k -> 9580k
    Overhead: 16550k -> 16626k
    GGC runs: 207 -> 208

comparing insn-attrtab.c compilation at -O0 -g level:
  Amount of produced GGC garbage increased from 131708k to 132716k, overall 0.77%
    Overall memory needed: 90370k
    Peak memory use before GGC: 71893k
    Peak memory use after GGC: 46017k
    Maximum of released memory in single GGC run: 37357k
    Garbage: 131708k -> 132716k
    Leak: 11269k -> 11269k
    Overhead: 16943k -> 17020k
    GGC runs: 206 -> 207

comparing insn-attrtab.c compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 96782k to 101074k, overall 4.43%
  Peak amount of GGC memory allocated before garbage collecting increased from 71901k to 76254k, overall 6.05%
  Peak amount of GGC memory still allocated after garbage collectin increased from 68033k to 72386k, overall 6.40%
  Amount of memory still referenced at the end of compilation increased from 9405k to 9525k, overall 1.27%
    Overall memory needed: 96782k -> 101074k
    Peak memory use before GGC: 71901k -> 76254k
    Peak memory use after GGC: 68033k -> 72386k
    Maximum of released memory in single GGC run: 31412k -> 31284k
    Garbage: 229266k -> 229214k
    Leak: 9405k -> 9525k
    Overhead: 29488k -> 29492k
    GGC runs: 222 -> 219

comparing insn-attrtab.c compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 79588k to 83940k, overall 5.47%
  Peak amount of GGC memory still allocated after garbage collectin increased from 73752k to 78105k, overall 5.90%
  Amount of memory still referenced at the end of compilation increased from 9403k to 9522k, overall 1.27%
    Overall memory needed: 114090k -> 113714k
    Peak memory use before GGC: 79588k -> 83940k
    Peak memory use after GGC: 73752k -> 78105k
    Maximum of released memory in single GGC run: 29700k -> 29572k
    Garbage: 281121k -> 281042k
    Leak: 9403k -> 9522k
    Overhead: 35351k -> 35349k
    GGC runs: 243 -> 242

comparing insn-attrtab.c compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 104470k to 113706k, overall 8.84%
  Peak amount of GGC memory allocated before garbage collecting increased from 79613k to 83981k, overall 5.49%
  Peak amount of GGC memory still allocated after garbage collectin increased from 73778k to 78145k, overall 5.92%
  Amount of memory still referenced at the end of compilation increased from 9408k to 9527k, overall 1.27%
    Overall memory needed: 104470k -> 113706k
    Peak memory use before GGC: 79613k -> 83981k
    Peak memory use after GGC: 73778k -> 78145k
    Maximum of released memory in single GGC run: 29893k -> 29761k
    Garbage: 281958k -> 281891k
    Leak: 9408k -> 9527k
    Overhead: 35580k -> 35581k
    GGC runs: 245 -> 242

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 119830k
    Peak memory use before GGC: 93042k -> 93043k
    Peak memory use after GGC: 92120k
    Maximum of released memory in single GGC run: 19382k -> 18912k
    Garbage: 212348k -> 208226k
    Leak: 49015k -> 49015k
    Overhead: 21554k -> 21200k
    GGC runs: 415 -> 408

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 132298k
    Peak memory use before GGC: 105317k -> 105318k
    Peak memory use after GGC: 104273k
    Maximum of released memory in single GGC run: 19024k -> 18749k
    Garbage: 218932k -> 214805k
    Leak: 72441k -> 72446k
    Overhead: 27458k -> 27104k
    GGC runs: 387 -> 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 119078k to 139602k, overall 17.24%
  Peak amount of GGC memory allocated before garbage collecting increased from 95909k to 112865k, overall 17.68%
  Peak amount of GGC memory still allocated after garbage collectin increased from 94957k to 111747k, overall 17.68%
  Amount of produced GGC garbage increased from 437113k to 438371k, overall 0.29%
  Amount of memory still referenced at the end of compilation increased from 51084k to 60894k, overall 19.20%
    Overall memory needed: 119078k -> 139602k
    Peak memory use before GGC: 95909k -> 112865k
    Peak memory use after GGC: 94957k -> 111747k
    Maximum of released memory in single GGC run: 17925k
    Garbage: 437113k -> 438371k
    Leak: 51084k -> 60894k
    Overhead: 100574k -> 99311k
    GGC runs: 557 -> 549

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 119094k to 139646k, overall 17.26%
  Peak amount of GGC memory allocated before garbage collecting increased from 95935k to 112892k, overall 17.68%
  Peak amount of GGC memory still allocated after garbage collectin increased from 94983k to 111773k, overall 17.68%
  Amount of produced GGC garbage increased from 492472k to 493413k, overall 0.19%
  Amount of memory still referenced at the end of compilation increased from 52050k to 61852k, overall 18.83%
    Overall memory needed: 119094k -> 139646k
    Peak memory use before GGC: 95935k -> 112892k
    Peak memory use after GGC: 94983k -> 111773k
    Maximum of released memory in single GGC run: 17925k
    Garbage: 492472k -> 493413k
    Leak: 52050k -> 61852k
    Overhead: 59229k -> 58683k
    GGC runs: 610 -> 594

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 121686k to 141522k, overall 16.30%
  Peak amount of GGC memory allocated before garbage collecting increased from 98502k to 114994k, overall 16.74%
  Peak amount of GGC memory still allocated after garbage collectin increased from 96623k to 113482k, overall 17.45%
  Amount of produced GGC garbage increased from 512636k to 515683k, overall 0.59%
  Amount of memory still referenced at the end of compilation increased from 52027k to 61968k, overall 19.11%
    Overall memory needed: 121686k -> 141522k
    Peak memory use before GGC: 98502k -> 114994k
    Peak memory use after GGC: 96623k -> 113482k
    Maximum of released memory in single GGC run: 18325k
    Garbage: 512636k -> 515683k
    Leak: 52027k -> 61968k
    Overhead: 59108k -> 58932k
    GGC runs: 614 -> 598

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
  Amount of produced GGC garbage increased from 146984k to 148154k, overall 0.80%
    Overall memory needed: 137658k -> 137274k
    Peak memory use before GGC: 81607k
    Peak memory use after GGC: 58487k
    Maximum of released memory in single GGC run: 44559k
    Garbage: 146984k -> 148154k
    Leak: 8080k -> 8080k
    Overhead: 24980k -> 25066k
    GGC runs: 81 -> 80

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
  Amount of produced GGC garbage increased from 147251k to 148372k, overall 0.76%
    Overall memory needed: 137662k -> 137658k
    Peak memory use before GGC: 82253k
    Peak memory use after GGC: 59133k -> 59132k
    Maximum of released memory in single GGC run: 44208k -> 44207k
    Garbage: 147251k -> 148372k
    Leak: 9336k -> 9335k
    Overhead: 25475k -> 25561k
    GGC runs: 88

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 199561k to 200843k, overall 0.64%
  Peak amount of GGC memory still allocated after garbage collectin increased from 193374k to 194656k, overall 0.66%
    Overall memory needed: 423018k -> 424026k
    Peak memory use before GGC: 199561k -> 200843k
    Peak memory use after GGC: 193374k -> 194656k
    Maximum of released memory in single GGC run: 112475k
    Garbage: 282521k -> 281584k
    Leak: 29804k -> 29807k
    Overhead: 32120k -> 31953k
    GGC runs: 96 -> 91

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 199556k to 200838k, overall 0.64%
  Peak amount of GGC memory still allocated after garbage collectin increased from 193369k to 194651k, overall 0.66%
    Overall memory needed: 342850k -> 347870k
    Peak memory use before GGC: 199556k -> 200838k
    Peak memory use after GGC: 193369k -> 194651k
    Maximum of released memory in single GGC run: 111904k -> 111903k
    Garbage: 359580k -> 358637k
    Leak: 30387k -> 30390k
    Overhead: 47276k -> 47108k
    GGC runs: 103 -> 100

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
  Peak amount of GGC memory allocated before garbage collecting increased from 317693k to 319683k, overall 0.63%
  Peak amount of GGC memory still allocated after garbage collectin increased from 296168k to 298157k, overall 0.67%
    Overall memory needed: 931542k -> 929806k
    Peak memory use before GGC: 317693k -> 319683k
    Peak memory use after GGC: 296168k -> 298157k
    Maximum of released memory in single GGC run: 172457k -> 172128k
    Garbage: 496497k -> 494413k
    Leak: 45440k -> 45445k
    Overhead: 59259k -> 59039k
    GGC runs: 97 -> 96

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-01-02 18:08:34.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-01-03 09:55:50.000000000 +0000
@@ -1,3 +1,122 @@
+2007-01-03  Kazu Hirata  <kazu@codesourcery.com>
+
+	* config/i386/i386.h (NON_STACK_REG_P, REGNO_OK_FOR_SIREG_P,
+	REGNO_OK_FOR_DIREG_P, REWRITE_ADDRESS, ASM_OPERAND_LETTER,
+	RET, AT_SP): Remove.
+	* config/i386/i386.md (*sse_prologue_save_insn): Use return
+	instead of RET.
+
+	* alias.c (init_alias_analysis): Use VEC_safe_grow_cleared.
+	* cfgbuild.c (find_basic_blocks): Likewise.
+	* cfgrtl.c (rtl_create_basic_block): Likewise.
+	* function.c (temp_slots_at_level): Likewise.
+	* reg-stack.c (stack_regs_mentioned): Likewise.
+	* regclass.c (allocate_reg_info): Likewise.
+	* tree-cfg.c (init_empty_tree_cfg, build_tree_cfg, create_bb,
+	set_bb_for_stmt, move_block_to_fn): Likewise.
+	* tree-complex.c (tree_lower_complex): Likewise.
+	* vec.h (VEC_safe_grow_cleared): New.
+
+	* cgraphunit.c, tree-ssa-alias.c: Fix comment typos.
+
+2007-01-03  Zdenek Dvorak <dvorakz@suse.cz>
+
+	* loop-unswitch.c (unswitch_loop): Pass probabilities to loopify.
+	* tree-ssa-loop-unswitch.c (tree_unswitch_loop): Pass probabilities
+	to loop_version.
+	* cfgloopmanip.c (scale_loop_frequencies): Export.
+	(loopify): Scale the frequencies by prescribed coefficients.
+	(set_zero_probability): New function.
+	(duplicate_loop_to_header_edge): Improve updating of frequencies.
+	(lv_adjust_loop_entry_edge, loop_version): Set probabilities
+	and frequencies according to arguments.
+	* tree-ssa-loop-manip.c (tree_unroll_loop): Set probabilities
+	correctly.
+	* cfg.c (scale_bbs_frequencies_int): Allow scaling the frequencies up.
+	* modulo-sched.c (sms_schedule): Set probabilities for entering
+	versioned loop correctly.
+	* tree-vect-transform.c (vect_transform_loop): Ditto.
+	* cfgloop.h (loopify, loop_version): Declaration changed.
+	(scale_loop_frequencies): Declared.
+
+2007-01-02  Jan Hubicka  <jh@suse.cz>
+
+	* cgraph.c: Include tree-flow.h
+	(cgraph_add_new-function): Handle IPA_SSA mode; execute
+	early_local_passes.
+	* cgraph.h (enum cgraph_state): Add CGRAPH_STATE_IPA_SSA.
+	* tree-pass.h (pass_all_early_optimizations): Declare.
+	* cgraphunit.c (cgraph_process_new_functions): Add IPA_SSA; execute
+	early_local_passes.
+	(cgraph_analyze_function): Do early_local_passes.
+	* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for):
+	Do not add referenced vars.
+	* tree-optimize.c (gate_all_optimizations): Do not execute when not in
+	SSA form.
+	(gate_all_early_local_passes): New gate.
+	(pass_early_local_passes): Use new gate.
+	(execute_early_local_optimizations): New functions.
+	(gate_all_early_optimizations): New gate.
+	(pass_all_early_optimizations): New pass.
+	(execute_free_datastructures): Free SSA only when initialized.
+	(gate_init_datastructures): Init only when optimizing.
+	(tree_lowering_passes): Do early local passes when called late.
+	* tree-profile.c (do_tree_profiling): Don't profile functions added
+	late.
+	(do_early_tree_profiling, pass_early_tree_profile): Kill.
+	* tree-cfg.c (update_modified_stmts): Do not update when operands are
+	not active.
+	* passes.c (init_optimizations_passes): Reorder so we go into SSA
+	during early_local_passes.
+	* Makefile.in (cgraph.o): Add dependency on tree-flow.h.
+
+
+2007-01-02  Carlos O'Donell  <carlos@codesourcery.com>
+
+	* Makefile.in: Update copyright year.
+
+2007-01-02  Carlos O'Donell  <carlos@codesourcery.com>
+
+	* Makefile.in: Export GCC_EXEC_PREFIX before calling $(RUNTEST)
+	in $(lang_checks) and check-consistency targets.
+
+2007-01-02  Jan Hubicka  <jh@suse.cz>
+
+	* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for):
+	Do not add referenced vars.
+	* tree-cfg.c (update_modified_stmts): Do not update when SSA operands
+	are not active.
+	* passes.c (init_optimization_passes): Put mudflap_2 after
+	free_datastructures.
+
+2007-01-02  Jan Hubicka  <jh@suse.cz>
+
+	* tree-optimize (execute_fixup_cfg): Set after_inlining flag.
+	Set NOTHROW flag on call statements proved to be nothrow.
+	Update statement of local calls so new pure/const functions are
+	updated. Update_ssa when in ssa form. Mark PHI nodes of nonlocal
+	goto receivers.
+	(tree_rest_of_compilation): Register hooks and initialize bitmap
+	early. Do not set after_inlining flag.
+
+2007-01-02  Steve Ellcey  <sje@cup.hp.com>
+
+	* sbitmap.c (HOST_BITS_PER_LONG_LONG):  Change to
+	HOST_BITS_PER_LONGLONG 
+
+2007-01-02  Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+	PR c/19977
+	* c-typeck.c (store_init_value): Don't emit pedantic overflow
+	warning for non-static initializers.
+	
+2007-01-02  Steven Bosscher  <steven@gcc.gnu.org>
+
+	* config/alpha/alpha.md, arm/arm.c, darwin.c, frv/frv.md,
+	m32r/m32r.c, m32r/m32r.c, mn10300/mn10300.md, pa/pa.c,
+	rs6000/rs6000.c, s390/s390.md, sh/sh.md, sparc/sparc.c:
+	Always use set_unique_reg_note to add REG_EQUAL notes.
+
 2007-01-02  Kazu Hirata  <kazu@codesourcery.com>
 
 	Revert:
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-01-02 17:54:58.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-01-03 09:55:31.000000000 +0000
@@ -1,3 +1,7 @@
+2007-01-03  Kazu Hirata  <kazu@codesourcery.com>
+
+	* pt.c: Fix a comment typo.
+
 2006-01-02  Ian Lance Taylor  <iant@google.com>
 
 	* semantics.c (maybe_convert_cond): Optionally warn when using an


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