A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Mon Feb 5 09:11: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: 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: 7399k
    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: 7495k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 309k
    Garbage: 450k
    Leak: 2291k
    Overhead: 456k
    GGC runs: 4

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

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

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17819k
    Peak memory use before GGC: 9327k
    Peak memory use after GGC: 8890k
    Maximum of released memory in single GGC run: 2633k
    Garbage: 37259k
    Leak: 6538k
    Overhead: 4655k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19727k -> 19723k
    Peak memory use before GGC: 10916k
    Peak memory use after GGC: 10550k
    Maximum of released memory in single GGC run: 2393k
    Garbage: 37829k
    Leak: 9414k
    Overhead: 5358k
    GGC runs: 271

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35299k -> 35295k
    Peak memory use before GGC: 19563k
    Peak memory use after GGC: 19361k
    Maximum of released memory in single GGC run: 2216k
    Garbage: 58407k
    Leak: 6562k
    Overhead: 6164k
    GGC runs: 356

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37707k -> 37719k
    Peak memory use before GGC: 19568k
    Peak memory use after GGC: 19374k
    Maximum of released memory in single GGC run: 2208k
    Garbage: 70384k
    Leak: 6681k
    Overhead: 7821k
    GGC runs: 409

comparing combine.c compilation at -O3 level:
    Overall memory needed: 46039k
    Peak memory use before GGC: 20766k
    Peak memory use after GGC: 19876k
    Maximum of released memory in single GGC run: 3154k
    Garbage: 105050k
    Leak: 6817k
    Overhead: 12211k
    GGC runs: 461

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 104599k
    Peak memory use before GGC: 70356k
    Peak memory use after GGC: 45188k
    Maximum of released memory in single GGC run: 37701k
    Garbage: 131161k
    Leak: 9581k
    Overhead: 15666k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 106131k
    Peak memory use before GGC: 71518k
    Peak memory use after GGC: 46456k
    Maximum of released memory in single GGC run: 37702k
    Garbage: 132317k
    Leak: 11271k
    Overhead: 16060k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147935k -> 149499k
    Peak memory use before GGC: 86800k
    Peak memory use after GGC: 80983k
    Maximum of released memory in single GGC run: 33275k
    Garbage: 269604k
    Leak: 9398k
    Overhead: 27282k
    GGC runs: 226

comparing insn-attrtab.c compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 192311k to 196727k, overall 2.30%
    Overall memory needed: 192311k -> 196727k
    Peak memory use before GGC: 88116k
    Peak memory use after GGC: 81051k
    Maximum of released memory in single GGC run: 31604k
    Garbage: 304746k
    Leak: 9395k
    Overhead: 32895k
    GGC runs: 246

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 196751k -> 196739k
    Peak memory use before GGC: 88130k
    Peak memory use after GGC: 81064k
    Maximum of released memory in single GGC run: 31674k
    Garbage: 305458k
    Leak: 9400k
    Overhead: 33096k
    GGC runs: 246

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 151647k
    Peak memory use before GGC: 92636k
    Peak memory use after GGC: 91719k
    Maximum of released memory in single GGC run: 18923k
    Garbage: 209437k
    Leak: 49262k
    Overhead: 21554k
    GGC runs: 409

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 169783k -> 169807k
    Peak memory use before GGC: 105259k
    Peak memory use after GGC: 104216k
    Maximum of released memory in single GGC run: 19099k
    Garbage: 216065k
    Leak: 72687k
    Overhead: 27476k
    GGC runs: 383

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 145156k -> 145160k
    Peak memory use before GGC: 103343k
    Peak memory use after GGC: 102259k
    Maximum of released memory in single GGC run: 18066k
    Garbage: 393904k
    Leak: 50086k
    Overhead: 30256k
    GGC runs: 549

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 146216k -> 146212k
    Peak memory use before GGC: 103721k
    Peak memory use after GGC: 102694k
    Maximum of released memory in single GGC run: 18061k
    Garbage: 434398k
    Leak: 50775k
    Overhead: 35395k
    GGC runs: 601

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 149404k
    Peak memory use before GGC: 104990k
    Peak memory use after GGC: 103914k
    Maximum of released memory in single GGC run: 18492k
    Garbage: 456007k
    Leak: 50863k
    Overhead: 37019k
    GGC runs: 611

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 246463k
    Peak memory use before GGC: 82632k
    Peak memory use after GGC: 59515k
    Maximum of released memory in single GGC run: 45585k
    Garbage: 148104k
    Leak: 8082k
    Overhead: 24864k
    GGC runs: 80

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

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 260479k -> 260379k
    Peak memory use before GGC: 104834k
    Peak memory use after GGC: 101620k
    Maximum of released memory in single GGC run: 51846k
    Garbage: 241495k
    Leak: 25176k
    Overhead: 28735k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 532207k
    Peak memory use before GGC: 104828k
    Peak memory use after GGC: 101615k
    Maximum of released memory in single GGC run: 37189k
    Garbage: 273333k
    Leak: 25605k
    Overhead: 34774k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1183243k -> 1183239k
    Peak memory use before GGC: 201488k
    Peak memory use after GGC: 189830k
    Maximum of released memory in single GGC run: 80890k
    Garbage: 373285k
    Leak: 45260k
    Overhead: 46802k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-04 15:56:44.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-05 07:28:46.000000000 +0000
@@ -1,3 +1,41 @@
+2007-02-04  Zdenek Dvorak <dvorakz@suse.cz>
+
+	* cfgcleanup.c (try_optimize_cfg): Avoid removing ENTRY_BLOCK_PTR.
+
+2007-02-04  Zdenek Dvorak <dvorakz@suse.cz>
+
+	* cfgloopmanip.c (loop_delete_branch_edge): Removed.
+	(remove_path): Use can_remove_branch_p and remove_branch instead
+	of loop_delete_branch_edge.
+	* tree-ssa-loop-manip.c (scale_dominated_blocks_in_loop): New function.
+	(tree_transform_and_unroll_loop): Remove dead branches immediately.
+	Update profile using scale_dominated_blocks_in_loop.
+	* cfghooks.c (can_remove_branch_p, remove_branch): New functions.
+	* cfghooks.h (struct cfg_hooks): Add can_remove_branch_p.
+	(can_remove_branch_p, remove_branch): Declare.
+	* tree-cfg.c (tree_can_remove_branch_p): New function.
+	(tree_cfg_hooks): Add tree_can_remove_branch_p.
+	* cfgrtl.c (rtl_can_remove_branch_p): New function.
+	(rtl_cfg_hooks, cfg_layout_rtl_cfg_hook): Add rtl_can_remove_branch_p.
+
+2007-02-05  Jan Hubicka  <jh@suse.cz>
+
+	PR middle-end/30696
+	* ipa-inline.c (cgraph_clone_inlined_nodes): When there are unanalyzed
+	nodes in cgraph, don't remove offline copy of the function.
+
+2007-02-04  Jan Hubicka  <jh@suse.cz>
+
+	* tree-sra.c (sra_walk_expr): Add linebreaks. BITFIELD_REFs into
+	vectors might cause maybe_lookup_element_for_expr to be called
+	on non-sra-candidate.
+
+2007-02-04  Kazu Hirata  <kazu@codesourcery.com>
+
+	* config/bfin/bfin-modes.def, config/bfin/bfin.c,
+	config/bfin/bfin.md, config/bfin/predicates.md: Follow
+	spelling conventions.
+
 2007-02-04  Richard Guenther  <rguenther@suse.de>
 
 	PR middle-end/30636
@@ -9,12 +47,11 @@
 	* passes.c (init_optimization_passes): Reindent.
 
 2007-02-04  Jan Hubicka  <jh@suse.cz>
-	    Eric Botcazou  <ebotcazou@libertysurf.fr>
+	    Eric Botcazou  <ebotcazou@adacore.com>
 
-	* tree-optimize.c (has_abnormal_outgoing_edge_p): Move to tree-inline.
+	* tree-optimize.c (has_abnormal_outgoing_edge_p): Move to...
 	(execute_fixup_cfg): Break out the abnormal goto code.
-	* tree-inline.c (has_abnormal_outgoing_edge_p): Move here from
-	tree-optimize.c.
+	* tree-inline.c (has_abnormal_outgoing_edge_p): ...here.
 	(make_nonlocal_label_edges): Move here from execute_fixup_cfg.
 	(optimize_inline_calls): Call make_nonlocal_label_edges.
 


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