A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Mon Feb 26 03:46: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 -> 7384k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2292k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7399k -> 7400k
    Peak memory use before GGC: 2297k
    Peak memory use after GGC: 1986k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2325k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7515k -> 7512k
    Peak memory use before GGC: 2269k
    Peak memory use after GGC: 1958k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7523k -> 7520k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7523k -> 7520k
    Peak memory use before GGC: 2270k
    Peak memory use after GGC: 1959k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2295k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17879k -> 17880k
    Peak memory use before GGC: 9277k
    Peak memory use after GGC: 8859k
    Maximum of released memory in single GGC run: 2584k
    Garbage: 37118k
    Leak: 6579k
    Overhead: 5037k
    GGC runs: 279

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19891k -> 19892k
    Peak memory use before GGC: 10887k
    Peak memory use after GGC: 10519k
    Maximum of released memory in single GGC run: 2355k
    Garbage: 37710k
    Leak: 9480k
    Overhead: 5744k
    GGC runs: 269

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35303k -> 35300k
    Peak memory use before GGC: 19350k
    Peak memory use after GGC: 19135k
    Maximum of released memory in single GGC run: 2169k
    Garbage: 57399k -> 57419k
    Leak: 6616k
    Overhead: 6371k -> 6372k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37583k -> 37588k
    Peak memory use before GGC: 19387k
    Peak memory use after GGC: 19185k
    Maximum of released memory in single GGC run: 2157k
    Garbage: 68663k -> 68680k
    Leak: 6725k
    Overhead: 7996k -> 7997k
    GGC runs: 403

comparing combine.c compilation at -O3 level:
    Overall memory needed: 47019k -> 47020k
    Peak memory use before GGC: 20424k
    Peak memory use after GGC: 19542k
    Maximum of released memory in single GGC run: 3135k
    Garbage: 101007k -> 101010k
    Leak: 6865k
    Overhead: 12222k -> 12222k
    GGC runs: 453

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 103215k -> 103208k
    Peak memory use before GGC: 68882k
    Peak memory use after GGC: 44737k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 130211k
    Leak: 9350k
    Overhead: 16801k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104611k -> 104612k
    Peak memory use before GGC: 70043k
    Peak memory use after GGC: 46005k
    Maximum of released memory in single GGC run: 36678k
    Garbage: 131174k
    Leak: 11298k
    Overhead: 17198k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147627k -> 147616k
    Peak memory use before GGC: 85871k
    Peak memory use after GGC: 80078k
    Maximum of released memory in single GGC run: 32817k
    Garbage: 264120k
    Leak: 9410k
    Overhead: 27484k
    GGC runs: 225

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 191851k -> 191268k
    Peak memory use before GGC: 87187k
    Peak memory use after GGC: 80148k
    Maximum of released memory in single GGC run: 31177k
    Garbage: 298878k -> 298878k
    Leak: 9407k
    Overhead: 33061k -> 33061k
    GGC runs: 245

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 193175k -> 191812k
    Peak memory use before GGC: 87200k
    Peak memory use after GGC: 80161k
    Maximum of released memory in single GGC run: 31240k
    Garbage: 299536k -> 299537k
    Leak: 9412k
    Overhead: 33260k -> 33260k
    GGC runs: 245

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 147689k -> 147674k
    Peak memory use before GGC: 90479k
    Peak memory use after GGC: 89583k
    Maximum of released memory in single GGC run: 18003k
    Garbage: 209330k
    Leak: 49053k
    Overhead: 23532k
    GGC runs: 414

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 165621k -> 165638k
    Peak memory use before GGC: 103211k
    Peak memory use after GGC: 102187k
    Maximum of released memory in single GGC run: 18485k
    Garbage: 215834k
    Leak: 72366k
    Overhead: 29426k
    GGC runs: 386

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 141759k -> 141785k
    Peak memory use before GGC: 101823k
    Peak memory use after GGC: 100800k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 345387k -> 345654k
    Leak: 49766k
    Overhead: 30021k -> 30036k
    GGC runs: 528

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 143839k -> 143861k
    Peak memory use before GGC: 102498k -> 102497k
    Peak memory use after GGC: 101446k -> 101445k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 374170k -> 374542k
    Leak: 50368k
    Overhead: 33940k -> 33963k
    GGC runs: 562

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 391462k to 391859k, overall 0.10%
    Overall memory needed: 146427k -> 146485k
    Peak memory use before GGC: 104252k
    Peak memory use after GGC: 103218k
    Maximum of released memory in single GGC run: 17650k
    Garbage: 391462k -> 391859k
    Leak: 51028k
    Overhead: 35273k -> 35295k
    GGC runs: 574 -> 575

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244759k -> 244756k
    Peak memory use before GGC: 80969k
    Peak memory use after GGC: 58708k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 145362k
    Leak: 7619k
    Overhead: 24814k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245579k -> 245580k
    Peak memory use before GGC: 81615k
    Peak memory use after GGC: 59354k
    Maximum of released memory in single GGC run: 44123k
    Garbage: 145629k
    Leak: 9387k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245975k -> 246124k
    Peak memory use before GGC: 85141k
    Peak memory use after GGC: 74853k
    Maximum of released memory in single GGC run: 36136k
    Garbage: 223655k
    Leak: 20863k
    Overhead: 30547k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 499443k -> 499160k
    Peak memory use before GGC: 79840k
    Peak memory use after GGC: 74854k
    Maximum of released memory in single GGC run: 33434k
    Garbage: 230701k
    Leak: 20953k
    Overhead: 32630k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1188623k -> 1189216k
    Peak memory use before GGC: 201756k
    Peak memory use after GGC: 190218k
    Maximum of released memory in single GGC run: 80703k
    Garbage: 376734k
    Leak: 46318k
    Overhead: 49361k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-02-25 10:04:59.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-02-26 01:42:57.000000000 +0000
@@ -1,3 +1,130 @@
+2007-02-25  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR tree-optimization/30938
+	* tree-vect-transform.c (vectorizable_call): Fix off-by-one error:
+	use &dt[nargs-1] instead of &dt[nargs] in the call to
+	vect_is_simple_use().
+
+2007-02-25  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* reload.c (find_reloads_address_1): Handle PLUS expressions resulting
+	from register elimination as PRE_MODIFY / POST_MODIFY increments.
+	Do not attempt to handle MEM inside auto-inc expressions.
+	* reload1.c (eliminate_regs_1): Do not attempt to handle elimination
+	of a register modified by an auto-inc expression.  However, do handle
+	elimination of a register used as PRE_MODIFY / POST_MODIFY increment.
+	(elimination_effects): Prohibit elimination of a register modified
+	by an auto-inc expression.  Disable register elimination rules whose
+	target register is modified by an auto-inc expression with variable
+	increment.
+
+2007-02-25  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-ssa-loop-niter.c (compute_estimated_nb_iterations): Fix
+	off-by-one error.
+	(array_at_struct_end_p): New function.
+	(idx_infer_loop_bounds): Use it.
+	(estimate_numbers_of_iterations_loop): Export.
+	* predict.c (predict_loops): Use estimated_loop_iterations_int.
+	Do not use PRED_LOOP_EXIT on exits predicted by # of iterations.
+	(tree_estimate_probability): Call record_loop_exits.
+	* tree-data-ref.c (get_number_of_iters_for_loop): Replaced by ...
+	(estimated_loop_iterations, estimated_loop_iterations_int,
+	estimated_loop_iterations_tree): New functions.
+	(analyze_siv_subscript_cst_affine,
+	compute_overlap_steps_for_affine_1_2,
+	analyze_subscript_affine_affine): Use estimated_loop_iterations_int.
+	(analyze_miv_subscript): Use estimated_loop_iterations_tree.
+	* predict.def (PRED_LOOP_ITERATIONS): Update comment.
+	(PRED_LOOP_ITERATIONS_GUESSED): New.
+	* cfgloop.c (record_loop_exits): Do nothing if there are no loops.
+	* cfgloop.h (estimate_numbers_of_iterations_loop,
+	estimated_loop_iterations_int): Declare.
+
+2007-02-25  Mark Mitchell  <mark@codesourcery.com>
+
+	* doc/extend.texi: Document optional priority argument to
+	constructors and destructors.
+	* tree.c (init_priority_for_decl): Adjust GTY markers.
+	(init_ttree): Use priority-info hash functions for
+	init_priority_for_decl.
+	(tree_map_eq): Rename to ...
+	(tree_map_base_eq): ... this.
+	(tree_map_marked_p): Rename to ...
+	(tree_map_base_marked_p): ... this.
+	(tree_map_base_hash): New function.
+	(decl_init_priority_lookup): Rework.
+	(decl_fini_priority_lookup): New function.
+	(decl_priority_info): New function.
+	(decl_init_priority_insert): Use it.
+	(decl_fini_priority_insert): Likewise.
+	(decl_restrict_base_lookup): Adjust for refactoring of tree_map
+	hierarchy.
+	(decl_restrict_base_insert): Likewise.
+	(decl_debug_expr_insert): Likewise.
+	(decl_value_expr_lookup): Likewise.
+	(decl_value_expr_insert): Likewise.
+	* tree.h (priority_type): New type.
+	(decl_init_priority_lookup): Use priority_type.
+	(decl_fini_priority_lookup): New function.
+	(decl_init_priority_insert): Use priority_type.
+	(decl_fini_priority_insert): New function.
+	(DECL_HAS_INIT_PRIORITY): Tweak comments.
+	(DECL_INIT_PRIORITY): Likewise.
+	(SET_DECL_INIT_PRIORITY): Add comment.
+	(DECL_FINI_PRIORITY): New macro.
+	(SET_DECL_FINI_PRIORITY): Likewise.
+	(DEFAULT_INIT_PRIORITY): Document.
+	(MAX_INIT_PRIORITY): Likewise.
+	(MAX_RESERVED_INIT_PRIORITY): Likewise.
+	(tree_map_base): New type.
+	(tree_map_base_eq): New function.
+	(tree_map_base_hash): Likewise.
+	(tree_map_base_marked_p): Likewise.
+	(tree_map): Inherit from tree_map_base.
+	(tree_map_eq): Make it a macro.
+	(tree_map_marked_p): Likewise.
+	(tree_int_map): Inherit from tree_map_base.
+	(tree_int_map_eq): Make it a macro.
+	(tree_int_map_hash): Likewise.
+	(tree_int_map_marked_p): Likewise.
+	(tree_priority_map): New type.
+	(tree_priority_map_eq): New macro.
+	(tree_priority_map_hash): Likewise.
+	(tree_priority_map_marked_p): Likewise.
+	* varasm.c (emults_decl): Adjust for refactoring of tree_map
+	hierarchy.
+	(emutls_common_1): Likewise.
+	* lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.
+	* tree-ssa-structalias.c (heapvar_lookup): Adjust for refactoring
+	of tree_map hierarchy.
+	* tree-cfg.c (move_stmt_r): Likewise.
+	(new_label_mapper): Likewise.
+	* c-tree.h (c_expand_body): Move to ...
+	* c-common.h (c_expand_body): ... here.
+	* c-decl.c (c_expand_body): Move to ...
+	* c-common.c (c_expand_body): ... here.
+	(c_common_attribute_table): Allow 1 argument for the constructor
+	and destructor attributes.
+	(get_priority): New function.
+	(handle_constructor_attribute): Set DECL_INIT_PRIORITY.
+	(handle_destructor_attribute): Set DECL_FINI_PRIORITY.
+
+2007-02-24  Jan Hubicka  <jh@suse.cz>
+
+	PR middle-end/30509
+	* tree-inline.c (copy_bb): Produce exact copy of EH info when copying for inlining.
+
+2007-02-24  Uros Bizjak  <ubizjak@gmail.com>
+	    Jan Hubicka  <jh@suse.cz>
+
+	PR target/30778
+	* i386.c (counter_mode): New function.
+	(expand_set_or_movmem_via_loop): Use it.
+	(expand_movmem_epilogue): Likewise; fix pasto.
+	(ix86_expand_movmem): Do emit guard even for constant counts.
+	(ix86_expand_setmem): Likewise.
+
 2007-02-25  Nick Clifton  <nickc@redhat.com>
 
 	* config/frv/frv.h (ASM_OUTPUT_CASE_LABEL): Delete.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-02-24 01:48:46.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-02-26 01:42:56.000000000 +0000
@@ -1,3 +1,20 @@
+2007-02-25  Mark Mitchell  <mark@codesourcery.com>
+
+	* cp-tree.h (static_ctors): Remove.
+	* cp-tree.h (static_dtors): Likewise.
+	* cp-objcp-common.c (decl_shadowed_for_var_lookup): Adjust for
+	refactoring of tree_map hierarchy.
+	(decl_shadowed_for_var_insert): Likewise.
+	* semantics.c (expand_body): Use c_expand_body.
+	(expand_or_defer_fn): Don't update static_ctors or static_dtors.
+	* decl2.c (static_ctors): Remove.
+	(static_dtors): Likewise.
+	(generate_ctor_or_dtor_function): Pass NULL_TREE to
+	objc_generate_static_init_call.  Do not call static_[cd]tors.
+	(generate_ctor_and_dtor_functions_for_priority): Do not check for
+	static_[cd]tors.
+	(cp_write_global_declarations): Likewise.
+
 2007-02-23  Richard Guenther  <rguenther@suse.de>
 
 	* class.c (note_name_declared_in_class): Make declaration


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