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

gcctest@suse.de gcctest@suse.de
Tue Feb 7 22:43:00 GMT 2006


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 combine.c compilation at -O0 level:
    Overall memory needed: 25324k -> 25320k
    Peak memory use before GGC: 9566k
    Peak memory use after GGC: 8914k
    Maximum of released memory in single GGC run: 2649k
    Garbage: 40064k
    Leak: 6740k
    Overhead: 5738k
    GGC runs: 313

comparing combine.c compilation at -O1 level:
    Overall memory needed: 26900k
    Peak memory use before GGC: 17435k
    Peak memory use after GGC: 17256k
    Maximum of released memory in single GGC run: 2310k -> 2308k
    Garbage: 62590k -> 62427k
    Leak: 6889k -> 6890k
    Overhead: 7488k -> 7487k
    GGC runs: 393 -> 392

comparing combine.c compilation at -O2 level:
    Overall memory needed: 26900k
    Peak memory use before GGC: 17438k
    Peak memory use after GGC: 17256k
    Maximum of released memory in single GGC run: 2410k -> 2399k
    Garbage: 83419k -> 82367k
    Leak: 6975k -> 6976k
    Overhead: 10317k -> 10226k
    GGC runs: 451 -> 461

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 18414k to 18453k, overall 0.21%
  Peak amount of GGC memory still allocated after garbage collectin increased from 17970k to 17993k, overall 0.13%
  Amount of memory still referenced at the end of compilation increased from 7041k to 7049k, overall 0.11%
    Overall memory needed: 26900k
    Peak memory use before GGC: 18414k -> 18453k
    Peak memory use after GGC: 17970k -> 17993k
    Maximum of released memory in single GGC run: 3384k -> 3491k
    Garbage: 115525k -> 113575k
    Leak: 7041k -> 7049k
    Overhead: 14093k -> 13950k
    GGC runs: 503 -> 518

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 80948k
    Peak memory use before GGC: 69508k
    Peak memory use after GGC: 45045k
    Maximum of released memory in single GGC run: 36220k
    Garbage: 146687k
    Leak: 9892k
    Overhead: 19751k
    GGC runs: 247

comparing insn-attrtab.c compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 91975k to 92087k, overall 0.12%
  Peak amount of GGC memory still allocated after garbage collectin increased from 81073k to 81246k, overall 0.21%
  Amount of memory still referenced at the end of compilation increased from 10055k to 10076k, overall 0.21%
    Overall memory needed: 109564k -> 109264k
    Peak memory use before GGC: 91975k -> 92087k
    Peak memory use after GGC: 81073k -> 81246k
    Maximum of released memory in single GGC run: 32142k -> 32383k
    Garbage: 296454k -> 296338k
    Leak: 10055k -> 10076k
    Overhead: 36102k -> 36186k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O2 level:
  Ovarall memory allocated via mmap and sbrk decreased from 122556k to 110872k, overall -10.54%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 109357k to 93801k, overall -16.58%
  Peak amount of GGC memory still allocated after garbage collectin increased from 80974k to 81341k, overall 0.45%
  Amount of produced GGC garbage decreased from 381033k to 343618k, overall -10.89%
    Overall memory needed: 122556k -> 110872k
    Peak memory use before GGC: 109357k -> 93801k
    Peak memory use after GGC: 80974k -> 81341k
    Maximum of released memory in single GGC run: 31577k -> 31927k
    Garbage: 381033k -> 343618k
    Leak: 10157k -> 10059k
    Overhead: 47872k -> 44783k
    GGC runs: 274

comparing insn-attrtab.c compilation at -O3 level:
  Ovarall memory allocated via mmap and sbrk decreased from 122612k to 110836k, overall -10.62%
  Peak amount of GGC memory allocated before garbage collecting run decreased from 109385k to 93831k, overall -16.58%
  Peak amount of GGC memory still allocated after garbage collectin increased from 81002k to 81371k, overall 0.46%
  Amount of produced GGC garbage decreased from 381623k to 344268k, overall -10.85%
    Overall memory needed: 122612k -> 110836k
    Peak memory use before GGC: 109385k -> 93831k
    Peak memory use after GGC: 81002k -> 81371k
    Maximum of released memory in single GGC run: 31908k -> 32267k
    Garbage: 381623k -> 344268k
    Leak: 10161k -> 10063k
    Overhead: 48069k -> 44982k
    GGC runs: 276 -> 279

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 118424k
    Peak memory use before GGC: 95198k
    Peak memory use after GGC: 94250k
    Maximum of released memory in single GGC run: 20356k
    Garbage: 223714k
    Leak: 49472k
    Overhead: 37113k
    GGC runs: 369

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 108528k
    Peak memory use before GGC: 95331k
    Peak memory use after GGC: 93251k
    Maximum of released memory in single GGC run: 20233k
    Garbage: 565076k -> 564795k
    Leak: 52291k -> 52294k
    Overhead: 63655k -> 63643k
    GGC runs: 531

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 108532k
    Peak memory use before GGC: 95331k
    Peak memory use after GGC: 93252k
    Maximum of released memory in single GGC run: 20232k
    Garbage: 690223k -> 687278k
    Leak: 53426k -> 53428k
    Overhead: 77124k -> 76837k
    GGC runs: 617 -> 618

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 114280k -> 114204k
    Peak memory use before GGC: 96797k
    Peak memory use after GGC: 94327k
    Maximum of released memory in single GGC run: 20729k
    Garbage: 753221k -> 753508k
    Leak: 54359k -> 54360k
    Overhead: 81858k -> 81753k
    GGC runs: 626 -> 629

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2006-02-07 12:11:05.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2006-02-07 22:35:12.000000000 +0000
@@ -1,3 +1,98 @@
+2006-02-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	* config/sol26.h (CPP_SUBTARGET_SPEC): Accept -pthread.
+	* config/sol2.h (CPP_SUBTARGET_SPEC): Likewise.
+	(LIB_SPEC): Likewise.
+	* doc/invoke.texi (SPARC options): Document -pthread.
+
+2006-02-07  Geoffrey Keating  <geoffk@apple.com>
+
+	* config/i386/i386.c (ix86_delegitimize_address): Support Darwin
+	PIC addresses.
+
+2006-02-07  Roger Sayle  <roger@eyesopen.com>
+
+	* config/sparc/sparc.c (sparc_type_code): Don't handle CHAR_TYPE.
+	Correct comment describing BOOLEAN_TYPE.
+
+2006-02-07  Dirk Mueller  <dmueller@suse.com>
+
+	* c.opt: C++ frontend supports -Wdiv-by-zero.
+	* c-opts.c (c_common_handle_option): Remove dead case.
+
+2006-02-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	* configure.ac (TLS assembler check): Do not enable TLS by
+	default on SPARC/Solaris before version 10.
+	* configure: Regenerate.
+
+2006-02-07  David Edelsohn  <edelsohn@gnu.org>
+
+	* doc/invoke.texi (xl-compat): Document conversion and support
+	routine names.
+
+2006-02-07  Jeff Law  <law@redhat.com>
+
+	* tree-vrp.c (find_conditional_asserts): Update comments.
+	(simplify_stmt_for_jump_threading): New.
+	(identify_jump_threads, finalize_jump_threads): New.
+	(vrp_finalize): Call identify_jump_threads.
+	(execute_vrp): Call finalize_jump_threads.
+	* tree-ssa-dom.c (struct opt_stats_d): Remove num_iterations field.
+	(vrp_element, vrp_data, vrp_element_p): Remove.
+	(vrp_hash_elt, vrp_variables_stack): Remove.
+	(vrp_hash, vrp_eq, record_range): Remove.
+	(simplify_cond_and_lookup_avail_expr): Remove.
+	(extract_range_from_cond): Remove.
+	(thread_across_edge): Relocated into tree-ssa-threadedge.c.
+	(simplify_stmt_for_jump_threading): New.
+	(dom_thread_across_edge): New wrapper.
+	(tree_ssa_dominator_optimize): No longer initialize or
+	finalize any of the VRP datastructures.  Remove iteration
+	step and simplify as a result of removal of iteration step.
+	(pass_dominator): Perform a cfg cleanup after DOM.
+	(dom_opt_finalize_block): Use the new common routines
+	for threading jumps.  Simplify stack management slightly.
+	No longer need to unwind VRP state.
+	(record_equivalences_from_incoming_edge): No longer record
+	VRP information.
+	(eliminate_redundant_computations): No longer call
+	simplify_cond_and_lookup_avail_expr.
+	* tree-flow.h (potentially_threadable_block): Prototype.
+	(thread_across_edge): Likewise.
+	* Makefile.in (OBJS-common):  Add tree-ssa-threadedge.o
+	(tree-ssa-threadedge.o): Add dependencies.
+	* tree-ssa-threadedge.c: New file.
+	* passes.c (init_optimization_passes): Merge PHIs before
+	calling VRP.  Run VRP again late in the SSA optimization pipeline.
+
+2006-02-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	* df-core.c (df_set_blocks): Do not dereference function pointers.
+	(df_finish1): Likewise.
+	(df_hybrid_search_forward): Likewise.
+	(df_hybrid_search_backward): Likewise.
+	(df_iterative_dataflow): Likewise.
+	(df_analyze_problem): Likewise.
+	(df_compact_blocks): Likewise.
+	(df_dump): Likewise.
+	* df-scan.c (df_rescan_blocks): Likewise.
+	(df_record_entry_block_defs): Likewise.
+
+	* genconditions.c (write_conditions): Guard the definition of
+	'insn_conditions' with the check on GCC version.
+	(write_writer): Guard the traversal 'insn_conditions' with
+	the check on GCC version.
+
+2006-02-07  Richard Guenther  <rguenther@suse.de>
+
+	PR c++/26140
+	Revert
+	2006-01-30  Richard Guenther  <rguenther@suse.de>
+ 	PR c++/23372
+ 	* gimplify.c (gimplify_target_expr): Handle easy cases
+ 	without creating a temporary.
+
 2006-02-07  Pete Steinmetz  <steinmtz@us.ibm.com>
 
         * sched-rgn.c (compute_dom_prob_ps, compute_trg_info): Eradicate
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2006-02-07 12:11:05.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2006-02-07 22:35:00.000000000 +0000
@@ -1,3 +1,22 @@
+2006-02-07  Dirk Mueller  <dmueller@suse.com>
+
+	* typeck.c (build_binary_op): Annotate div-by-zero
+	warnings to make -Wno-div-by-zero have an effect.
+
+2006-02-07  Mark Mitchell  <mark@codesourcery.com>
+
+	PR c++/9737
+	* pt.c (coerce_template_template_parms): Do not templates with
+	excess default arguments to match template template parameters
+	with fewer parameters.
+	(coerce_template_parms): Add use_default_args parameter; use
+	default arguments only when true.
+	(lookup_template_class): Adjust call to coerce_template_parms.
+	(fn_type_unification): Likewise.
+	(unify): Likewise.
+	(get_bindings): Likewise.
+	(dependent_type_p): Add assertions.
+
 2006-02-06  Roger Sayle  <roger@eyesopen.com>
 
 	* decl.c (grokdeclarator): Don't bother checking for CHAR_TYPE.


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