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

gcctest@suse.de gcctest@suse.de
Sun Jan 14 23:45: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: 18345k
    Peak memory use before GGC: 2264k
    Peak memory use after GGC: 1955k
    Maximum of released memory in single GGC run: 309k
    Garbage: 444k
    Leak: 2288k
    Overhead: 455k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 18361k
    Peak memory use before GGC: 2291k
    Peak memory use after GGC: 1982k
    Maximum of released memory in single GGC run: 309k
    Garbage: 447k
    Leak: 2320k
    Overhead: 460k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 18453k
    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: 18465k
    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: 456k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 18465k
    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: 456k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 28625k -> 28629k
    Peak memory use before GGC: 9312k
    Peak memory use after GGC: 8864k
    Maximum of released memory in single GGC run: 2606k
    Garbage: 37297k
    Leak: 6538k
    Overhead: 4829k
    GGC runs: 276

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

comparing combine.c compilation at -O1 level:
    Overall memory needed: 33370k -> 33270k
    Peak memory use before GGC: 20031k -> 19924k
    Peak memory use after GGC: 19831k -> 19725k
    Maximum of released memory in single GGC run: 2264k
    Garbage: 55289k -> 55197k
    Leak: 6566k
    Overhead: 9960k -> 9960k
    GGC runs: 353

comparing combine.c compilation at -O2 level:
  Amount of memory still referenced at the end of compilation increased from 6686k to 6694k, overall 0.12%
    Overall memory needed: 33374k -> 33274k
    Peak memory use before GGC: 20040k -> 19933k
    Peak memory use after GGC: 19841k -> 19735k
    Maximum of released memory in single GGC run: 2206k
    Garbage: 71096k -> 70935k
    Leak: 6686k -> 6694k
    Overhead: 11867k -> 11862k
    GGC runs: 409 -> 410

comparing combine.c compilation at -O3 level:
    Overall memory needed: 32578k -> 32470k
    Peak memory use before GGC: 21080k -> 20881k
    Peak memory use after GGC: 20478k -> 20311k
    Maximum of released memory in single GGC run: 3126k -> 3125k
    Garbage: 103423k -> 103325k
    Leak: 6768k -> 6768k
    Overhead: 16336k -> 16334k
    GGC runs: 470

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 89190k
    Peak memory use before GGC: 70731k
    Peak memory use after GGC: 44750k
    Maximum of released memory in single GGC run: 37355k
    Garbage: 131553k
    Leak: 9580k
    Overhead: 16626k
    GGC runs: 210

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 90366k
    Peak memory use before GGC: 71893k
    Peak memory use after GGC: 46017k
    Maximum of released memory in single GGC run: 37357k
    Garbage: 132717k
    Leak: 11269k
    Overhead: 17020k
    GGC runs: 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 98202k -> 98154k
    Peak memory use before GGC: 72734k -> 72561k
    Peak memory use after GGC: 68888k -> 68716k
    Maximum of released memory in single GGC run: 31302k
    Garbage: 228282k -> 227952k
    Leak: 9397k
    Overhead: 29388k -> 29388k
    GGC runs: 222 -> 223

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 105526k -> 105158k
    Peak memory use before GGC: 79562k -> 79387k
    Peak memory use after GGC: 73753k -> 73577k
    Maximum of released memory in single GGC run: 29593k -> 29594k
    Garbage: 279541k -> 279218k
    Leak: 9395k
    Overhead: 35690k -> 35694k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 110378k -> 109994k
    Peak memory use before GGC: 79602k -> 79427k
    Peak memory use after GGC: 73793k -> 73617k
    Maximum of released memory in single GGC run: 29760k -> 29758k
    Garbage: 280265k -> 279917k
    Leak: 9399k
    Overhead: 35905k -> 35905k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 119834k -> 119806k
    Peak memory use before GGC: 93043k -> 93022k
    Peak memory use after GGC: 92120k -> 92099k
    Maximum of released memory in single GGC run: 18912k
    Garbage: 208221k -> 208221k
    Leak: 49015k
    Overhead: 21199k
    GGC runs: 407

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 132302k -> 132278k
    Peak memory use before GGC: 105317k -> 105299k
    Peak memory use after GGC: 104273k -> 104254k
    Maximum of released memory in single GGC run: 18749k -> 18752k
    Garbage: 214812k -> 214808k
    Leak: 72442k
    Overhead: 27104k -> 27104k
    GGC runs: 382

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting run decreased from 102899k to 98615k, overall -4.34%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 101880k to 97638k, overall -4.34%
    Overall memory needed: 132838k -> 130302k
    Peak memory use before GGC: 102899k -> 98615k
    Peak memory use after GGC: 101880k -> 97638k
    Maximum of released memory in single GGC run: 17926k -> 17925k
    Garbage: 397860k -> 394895k
    Leak: 50038k -> 50037k
    Overhead: 53236k -> 53231k
    GGC runs: 574 -> 572

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Peak amount of GGC memory allocated before garbage collecting run decreased from 103003k to 98683k, overall -4.38%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 101947k to 97705k, overall -4.34%
    Overall memory needed: 132878k -> 130362k
    Peak memory use before GGC: 103003k -> 98683k
    Peak memory use after GGC: 101947k -> 97705k
    Maximum of released memory in single GGC run: 17926k -> 17924k
    Garbage: 454649k -> 451692k
    Leak: 50816k -> 50815k
    Overhead: 46330k -> 46288k
    GGC runs: 630 -> 633

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting run decreased from 104577k to 100272k, overall -4.29%
  Peak amount of GGC memory still allocated after garbage collecting decreased from 103536k to 99239k, overall -4.33%
    Overall memory needed: 134754k -> 132182k
    Peak memory use before GGC: 104577k -> 100272k
    Peak memory use after GGC: 103536k -> 99239k
    Maximum of released memory in single GGC run: 18326k -> 18325k
    Garbage: 470546k -> 467160k
    Leak: 51030k -> 51029k
    Overhead: 45782k -> 45801k
    GGC runs: 643 -> 642

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 137646k
    Peak memory use before GGC: 81607k
    Peak memory use after GGC: 58487k
    Maximum of released memory in single GGC run: 44559k
    Garbage: 148154k
    Leak: 8080k
    Overhead: 25066k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 138198k
    Peak memory use before GGC: 82253k
    Peak memory use after GGC: 59133k
    Maximum of released memory in single GGC run: 44208k
    Garbage: 148325k
    Leak: 9335k
    Overhead: 25561k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 417842k to 436710k, overall 4.52%
  Peak amount of GGC memory allocated before garbage collecting increased from 200591k to 202594k, overall 1.00%
    Overall memory needed: 417842k -> 436710k
    Peak memory use before GGC: 200591k -> 202594k
    Peak memory use after GGC: 193289k -> 192571k
    Maximum of released memory in single GGC run: 112413k -> 137171k
    Garbage: 281276k -> 278226k
    Leak: 29804k
    Overhead: 32031k -> 32030k
    GGC runs: 92

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 341514k to 365202k, overall 6.94%
  Peak amount of GGC memory allocated before garbage collecting increased from 200583k to 207227k, overall 3.31%
    Overall memory needed: 341514k -> 365202k
    Peak memory use before GGC: 200583k -> 207227k
    Peak memory use after GGC: 193281k -> 192563k
    Maximum of released memory in single GGC run: 111840k -> 140362k
    Garbage: 358332k -> 355277k
    Leak: 30387k
    Overhead: 47186k -> 47185k
    GGC runs: 99 -> 98

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 run decreased from 299944k to 282245k, overall -6.27%
    Overall memory needed: 712662k -> 710702k
    Peak memory use before GGC: 299944k -> 282245k
    Peak memory use after GGC: 278930k -> 273215k
    Maximum of released memory in single GGC run: 158597k -> 138326k
    Garbage: 452446k -> 448504k
    Leak: 45440k
    Overhead: 56089k -> 56089k
    GGC runs: 97

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-01-14 00:24:54.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-01-14 21:58:47.000000000 +0000
@@ -1,3 +1,54 @@
+2007-01-14  Zdenek Dvorak <dvorakz@suse.cz>
+
+	* loop-unswitch.c (unswitch_loop): Do not call fix_loop_placement.
+	* cfgloopmanip.c (fix_loop_placement): Made static.  Use
+	get_loop_exit_edges.  Changed return type to bool.
+	* cfgloop.h (fix_loop_placement): Declaration removed.
+
+2007-01-14  Dorit Nuzman  <dorit@il.ibm.com>
+
+	* param.h (MIN_VECT_LOOP_BOUND): New.
+	* params.def (MIN_VECT_LOOP_BOUND): New.
+	* tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Takes another
+	argument - minimum threshold for number of iterations. 
+	* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge): Add another
+	argument to declaration.
+	* tree-vect-analyze.c (vect_analyze_operations): Check value of 
+	MIN_VECT_LOOP_BOUND.
+	* tree-vect-transform.c (vect_do_peeling_for_loop_bound): Call
+	slpeel_tree_peel_loop_to_edge with additional argument.
+	(vect_do_peeling_for_alignment): Likewise.
+	* doc/invoke.texi (min-vect-loop-bound): Document new param option.
+
+2007-01-14  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/30413
+	* config/i386/i386.c (print_operand) ['z']: Output 'b' for
+	operands of size 1.
+
+2007-01-14  Jan Hubicka  <jh@suse.cz>
+
+	* tree-dfa.c (remove_referenced_var): New function.
+	* tree-ssa-live.c (remove_unused_locals): Walk referenced vars and
+	prune referenced vars list too.
+	* tree-flow.h (remove_referenced_var): Declare.
+
+2007-01-14  Jan Hubicka  <jh@suse.cz>
+
+	* tree-eh.c (add_stmt_to_eh_region_fn): Do not add call_exprs
+	separately.
+	(remove_stmt_from_eh_region_fn): Do not remove call_exprs.
+	(verify_eh_throw_stmt_node, verify_eh_throw_table_statements): Kill.
+	* except.h (verify_eh_throw_table_statements): Kill prototype.
+	* cfgexpand.c (expand_gimple_basic_block): Propagate Eh regions
+	into call exrepssions.
+	* tree-optimize.c (execute_free_cfg_annotatiosn): Do not call
+	eh trhow verifier.
+	* tree-cfg.c: Include pointer-set.h.
+	(verify_node_sharing): Work on pointer set.
+	(verify_eh_throw_stmt_node): New.
+	(verify_stmts): Use pointers sets, verify throw_stmt.
+
 2007-01-13  Zdenek Dvorak <dvorakz@suse.cz>
 
 	* ipa-reference.c (analyze_function): Consider also addresses taken
@@ -596,7 +647,6 @@
 
 	* config/i386/i386.md (*sinxf2): Rename to *sinxf2_i387.
 	(*cosxf2): Rename to cosxf2_i387.
-
 	(*sindf2, *sinsf2): Extend operand 1 to XFmode.  Macroize patterns
 	using X87MODEF12 mode macro. Rename patterns to
 	*sin_extend<mode>xf2_i387.  Use SSE_FLOAT_MODE_P to disable patterns
@@ -604,9 +654,7 @@
 	(*cosdf2, *cossf2): Ditto.
 	(sincosdf3, sincossf3): Ditto.  Rewrite corresponding splitters
 	to match extended input operands.
-
 	(sincos<mode>3): New expander.
-
 	(*sinextendsfdf2, *cosextendsfdf2, *sincosextendsfdf3): Remove
 	insn patterns and corresponding splitters.
 


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