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

gcctest@suse.de gcctest@suse.de
Wed May 18 06:40:00 GMT 2005


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: 24808k -> 24816k
    Peak memory use before GGC: 9651k
    Peak memory use after GGC: 8963k
    Maximum of released memory in single GGC run: 2791k
    Garbage: 42422k
    Leak: 6711k
    Overhead: 5914k
    GGC runs: 330

comparing combine.c compilation at -O1 level:
  Amount of produced GGC garbage increased from 63255k to 63453k, overall 0.31%
    Overall memory needed: 27584k -> 27636k
    Peak memory use before GGC: 9186k -> 9177k
    Peak memory use after GGC: 8760k -> 8747k
    Maximum of released memory in single GGC run: 2219k -> 2204k
    Garbage: 63255k -> 63453k
    Leak: 7086k -> 7092k
    Overhead: 7641k -> 7690k
    GGC runs: 521 -> 525

comparing combine.c compilation at -O2 level:
  Amount of produced GGC garbage increased from 87701k to 88772k, overall 1.22%
  Amount of memory still referenced at the end of compilation increased from 7034k to 7042k, overall 0.11%
    Overall memory needed: 24852k
    Peak memory use before GGC: 18366k
    Peak memory use after GGC: 18179k
    Maximum of released memory in single GGC run: 2523k -> 2522k
    Garbage: 87701k -> 88772k
    Leak: 7034k -> 7042k
    Overhead: 10949k -> 11024k
    GGC runs: 483 -> 484

comparing combine.c compilation at -O3 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 18479k to 18563k, overall 0.45%
  Amount of produced GGC garbage increased from 122024k to 123558k, overall 1.26%
  Amount of memory still referenced at the end of compilation increased from 7133k to 7152k, overall 0.26%
    Overall memory needed: 25596k -> 25640k
    Peak memory use before GGC: 18479k -> 18563k
    Peak memory use after GGC: 18179k
    Maximum of released memory in single GGC run: 3390k
    Garbage: 122024k -> 123558k
    Leak: 7133k -> 7152k
    Overhead: 15052k -> 15239k
    GGC runs: 540 -> 545

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 85596k
    Peak memory use before GGC: 73852k
    Peak memory use after GGC: 45356k
    Maximum of released memory in single GGC run: 37612k
    Garbage: 154203k
    Leak: 11538k
    Overhead: 19905k
    GGC runs: 268

comparing insn-attrtab.c compilation at -O1 level:
  Peak amount of GGC memory allocated before garbage collecting run decreased from 81439k to 77258k, overall -5.41%
    Overall memory needed: 103340k -> 101264k
    Peak memory use before GGC: 81439k -> 77258k
    Peak memory use after GGC: 66613k -> 66356k
    Maximum of released memory in single GGC run: 35967k -> 37101k
    Garbage: 306641k -> 306690k
    Leak: 11599k
    Overhead: 37507k -> 37513k
    GGC runs: 386 -> 385

comparing insn-attrtab.c compilation at -O2 level:
  Amount of produced GGC garbage increased from 403168k to 410312k, overall 1.77%
    Overall memory needed: 156708k -> 155080k
    Peak memory use before GGC: 120517k -> 120391k
    Peak memory use after GGC: 95638k -> 94016k
    Maximum of released memory in single GGC run: 32923k -> 32813k
    Garbage: 403168k -> 410312k
    Leak: 11447k -> 11438k
    Overhead: 50375k -> 50912k
    GGC runs: 307

comparing insn-attrtab.c compilation at -O3 level:
  Amount of produced GGC garbage increased from 403961k to 411105k, overall 1.77%
    Overall memory needed: 156720k -> 155092k
    Peak memory use before GGC: 120519k -> 120393k
    Peak memory use after GGC: 95640k -> 94018k
    Maximum of released memory in single GGC run: 32923k -> 32813k
    Garbage: 403961k -> 411105k
    Leak: 11464k -> 11457k
    Overhead: 50496k -> 51036k
    GGC runs: 313 -> 312

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 126912k
    Peak memory use before GGC: 102906k -> 102907k
    Peak memory use after GGC: 101885k -> 101886k
    Maximum of released memory in single GGC run: 21112k
    Garbage: 247848k -> 247847k
    Leak: 53826k -> 53828k
    Overhead: 43099k -> 43099k
    GGC runs: 347

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of produced GGC garbage increased from 680555k to 681677k, overall 0.16%
    Overall memory needed: 120300k
    Peak memory use before GGC: 111954k -> 111955k
    Peak memory use after GGC: 100813k -> 100814k
    Maximum of released memory in single GGC run: 20026k -> 20025k
    Garbage: 680555k -> 681677k
    Leak: 57802k -> 57767k
    Overhead: 86820k -> 86875k
    GGC runs: 524 -> 525

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Amount of produced GGC garbage increased from 791695k to 794152k, overall 0.31%
    Overall memory needed: 120300k -> 120304k
    Peak memory use before GGC: 111954k -> 111955k
    Peak memory use after GGC: 100813k -> 100814k
    Maximum of released memory in single GGC run: 20025k
    Garbage: 791695k -> 794152k
    Leak: 58785k -> 58792k
    Overhead: 106819k -> 106916k
    GGC runs: 617 -> 622

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 814120k to 816794k, overall 0.33%
  Amount of memory still referenced at the end of compilation increased from 59276k to 59471k, overall 0.33%
    Overall memory needed: 123184k
    Peak memory use before GGC: 113951k -> 113953k
    Peak memory use after GGC: 102645k -> 102646k
    Maximum of released memory in single GGC run: 21328k -> 21329k
    Garbage: 814120k -> 816794k
    Leak: 59276k -> 59471k
    Overhead: 109903k -> 110047k
    GGC runs: 623 -> 628

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2005-05-17 17:02:09.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2005-05-18 05:34:23.000000000 +0000
@@ -1,3 +1,143 @@
+2005-05-17  Daniel Berlin  <dberlin@dberlin.org>
+
+	* tree-ssa-pre.c (find_or_generate_expression): CALL_EXPR
+	is okay too.
+
+2005-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* timevar.def (TV_SCEV_CONST): New timevar.
+	* tree-optimize.c (init_tree_optimization_passes): Add
+	pass_scev_cprop.
+	* tree-pass.h (pass_scev_cprop): Declare.
+	* tree-scalar-evolution.c (scev_const_prop): New function.
+	* tree-scalar-evolution.h (scev_const_prop): Declare.
+	* tree-ssa-loop.c (gate_scev_const_prop, pass_scev_cprop):
+	New.
+	* tree-cfg.c (replace_uses_by): Export.
+	* tree-flow.h (replace_uses_by): Declare.
+
+2005-05-17  Mike Stump  <mrs@apple.com>
+
+	Yet more Objective-C++...
+
+	* c-common.h (objc_finish_try_stmt): Add.
+	(objc_build_synchronized): Add.
+	(objc_generate_write_barrier): Add.
+	* stub-objc.c (objc_build_synchronized): Add return value.
+	(objc_finish_try_stmt): Likewise.
+	(objc_generate_write_barrier): Add.
+
+	* c-common.h (objc_rewrite_function_call): Add.
+	* c-typeck.c (build_function_call): Allow objc to rewrite
+	FUNCTION_DECLs.
+	(build_modify_expr): Allow objc to generate write barriers.
+	* c.opt (Wassign-intercept): Add.
+	(Wstrict-selector-match): Add.
+	(fobjc-call-cxx-cdtors): Add.
+	(fobjc-direct-dispatch): Add.
+	(fobjc-gc): Add.
+	* dbxout.c (get_lang_number): Add Objective-C++ support.
+	* doc/invoke.texi (-fobjc-call-cxx-cdtors): Likewise.
+	(-Wstrict-selector-match): Likewise.
+	(-fobjc-direct-dispatch): Likewise.
+	(-Wassign-intercept): Likewise.
+	(Overall Options): Likewise.
+	* gengtype.c (get_output_file_with_visibility): Likewise.
+	* stub-objc.c (objc_rewrite_function_call): Add.
+	* config/darwin.h (ASM_OUTPUT_LABELREF): Improved quoting support.
+
+	* c-common.c (flag_objc_exceptions): Remove.
+	(flag_objc_sjlj_exceptions): Remove.
+	* c-decl.c (objc_mark_locals_volatile): Don't change decls
+	that are already ok.
+	* c-opts.c (c_common_handle_option, case
+	OPT_fobjc_exceptions): Remove.
+	(case OPT_fobjc_sjlj_exceptions): Remove
+	* c.opt (fobjc-call-cxx-cdtors): Have opt create the flag.
+	(fobjc-exceptions): Likewise.
+	(fobjc-sjlj-exceptions): Likewise.
+	* config/rs6000/darwin.h (OFFS_MSGSEND_FAST): Add.
+	(OFFS_ASSIGNIVAR_FAST): Add.
+	
+2005-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	* config/sparc/sparc.md (movhi): Do not test constness
+	of operand #1 twice.
+	(movsi): Likewise.
+	(movdi): Unconditionally accept zero as second operand
+	when the first is memory.
+	(movdi_insn_sp32): Handle above case.
+	(DImode splitter): Use predicates.
+	(DImode splitter): Use const_zero_operand predicate.
+	(movsf_insn): Swap 2 alternatives.
+
+2005-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-ssa-loop-ivopts.c (find_bivs, find_givs_in_stmt_scev): Apply
+	expand_simple_operations to bases of the ivs.
+	(tree_int_cst_sign_bit): Export.
+	* tree-flow.h (expand_simple_operations): Declare.
+	* tree-ssa-loop-niter.c (number_of_iterations_cond): Use
+	tree_int_cst_sign_bit.
+	(expand_simple_operations): Export.
+	* tree.h (tree_int_cst_sign_bit): Declare.
+
+2005-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* tree-cfg.c (tree_can_merge_blocks_p): Allow phi nodes in the
+	merged block.
+	(replace_uses_by): New function.
+	(tree_merge_blocks): Eliminate the phi nodes in the merged block.
+	* tree-flow.h (fold_stmt_inplace): Declare.
+	* tree-ssa-ccp.c (fold_stmt_inplace): New function.
+	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update dominance
+	info after cfg cleanup.
+
+2005-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* cfgloop.h (just_once_each_iteration_p): Declaration changed.
+	* cfgloopanal.c (just_once_each_iteration_p): Make the loop argument
+	const.
+
+2005-05-17  Zdenek Dvorak  <dvorakz@suse.cz>
+
+	* ggc-page.c (ggc_alloc_stat): Record amount of memory allocated.
+	* ggc-zone.c (ggc_alloc_zone_1): Ditto.
+	* timevar.c (timevar_ggc_mem_total): New variable.
+	(GGC_MEM_BOUND): New constant.
+	(get_time): Record ggc memory status.
+	(timevar_accumulate): Accumulate amount of ggc memory.
+	(timevar_print): Print consumption of ggc memory.
+	* timevar.def (TV_FIND_REFERENCED_VARS, TV_TREE_REDPHI,
+	TV_TREE_LOOP_BOUNDS, TV_TREE_LOOP_IVCANON, TV_TREE_VECTORIZATION,
+	TV_TREE_LINEAR_TRANSFORM): Shorten strings to fit in 22 characters.
+	* timevar.h (struct timevar_time_def): Add ggc_mem field.
+	(timevar_ggc_mem_total): Declare.
+
+2005-05-17  Kazu Hirata  <kazu@cs.umass.edu>
+
+	* tree-into-ssa.c (update_ssa): Clean up by shortening the
+	live range of DFS.
+
+2005-05-17  Hans-Peter Nilsson  <hp@axis.com>
+
+	* config/cris/cris.md (ncond, ocode, rcond): Remove separate
+	define_code_attr.
+	("b<ncond:code>", "b<ocond:code>", "b<rcond:code>")
+	("*b<ncond:code>_reversed", "*b<ocond:code>_reversed")
+	("*b<rcond:code>_reversed", "s<ncond:code>", "s<rcond:code>")
+	("s<ocond:code>"): Rename from respectively "b<ncond>",
+	"b<ocond>", "b<rcond>", ("*b<ncond>_reversed",
+	"*b<ocond>_reversed", "*b<rcond>_reversed", "s<ncond>",
+	"s<rcond>" and "s<ocond>".
+	("b<ocond:code>", "*b<ocond:code>_reversed")
+	("*b<rcond:code>_reversed"): Remove extraneous backslashes in
+	output statement section.
+
+2005-05-17  Roger Sayle  <roger@eyesopen.com>
+
+	* c-typeck.c (common_type): Also handle BOOLEAN_TYPEs.
+
 2005-05-17  Steven Bosscher  <stevenb@suse.de>
 	    Stuart Hastings <stuart@apple.com>
 	    Jan Hubicka  <jh@suse.cz>
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2005-05-17 17:02:14.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2005-05-18 05:34:25.000000000 +0000
@@ -1,3 +1,89 @@
+2005-05-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR C++/19664
+	* decl2.c (determine_visibility): Don't set visibility to
+	hidden if it has been set explicitly by user.
+
+2005-05-17  Mike Stump  <mrs@apple.com>
+
+	Yet more Objective-C++...
+	
+	* cp-objcp-common.h (cxx_get_alias_set): Move from
+	here...
+	(cxx_warn_unused_global_decl): Likewise.
+	(cp_expr_size): Likewise.
+	(cp_tree_size): Likewise.
+	(cp_var_mod_type_p): Likewise.
+	(cxx_initialize_diagnostics): Likewise.
+	(cxx_types_compatible_p): Likewise.
+	* cp-tree.h: to here.
+	(do_poplevel): Add.
+	* lex.c (D_OBJC): Add.
+	(init_reswords): Add.
+	* Make-lang.in (cp/pt.o): Add cp/cp-objcp-common.h.
+	* parser.c: Add c-common.h include.
+	* pt.c: Add c-common.h and cp-objcp-common.h includes.
+	(template_args_equal): Use objc_comptypes as well.
+	(tsubst_copy_and_build): Use objcp_tsubst_copy_and_build as well.
+	* semantics.c (do_poplevel): Remove static.
+
+	* decl.c (objc_mark_locals_volatile): Don't change decls that are
+	already ok.
+	* decl2.c (generate_ctor_or_dtor_function): Add code to initialize
+	Objective C++ early enough.
+	* lex.c (struct resword reswords): Add Objective-C++ support.
+	* parser.c (cp_lexer_get_preprocessor_token): Add Objective-C++.
+	(cp_parser_objc_message_receiver): Add.
+	(cp_parser_objc_message_args): Likewise.
+	(cp_parser_objc_message_expression): Likewise.
+	(cp_parser_objc_encode_expression): Likewise.
+	(cp_parser_objc_defs_expression): Likewise.
+	(cp_parser_objc_protocol_expression): Likewise.
+	(cp_parser_objc_selector_expression): Likewise.
+	(cp_parser_objc_expression): Likewise.
+	(cp_parser_objc_visibility_spec): Likewise.
+	(cp_parser_objc_method_type): Likewise.
+	(cp_parser_objc_protocol_qualifiers): Likewise.
+	(cp_parser_objc_typename): Likewise.
+	(cp_parser_objc_selector_p): Likewise.
+	(cp_parser_objc_selector): Likewise.
+	(cp_parser_objc_method_keyword_params): Likewise.
+	(cp_parser_objc_method_tail_params_opt): Likewise.
+	(cp_parser_objc_interstitial_code): Likewise.
+	(cp_parser_objc_method_signature): Likewise.
+	(cp_parser_objc_method_prototype_list): Likewise.
+	(cp_parser_objc_method_definition_list): Likewise.
+	(cp_parser_objc_class_ivars): Likewise.
+	(cp_parser_objc_identifier_list): Likewise.
+	(cp_parser_objc_alias_declaration): Likewise.
+	(cp_parser_objc_class_declaration): Likewise.
+	(cp_parser_objc_protocol_declaration): Likewise.
+	(cp_parser_objc_protocol_refs_opt): Likewise.
+	(cp_parser_objc_superclass_or_category): Likewise.
+	(cp_parser_objc_class_interface): Likewise.
+	(cp_parser_objc_class_implementation): Likewise.
+	(cp_parser_objc_end_implementation): Likewise.
+	(cp_parser_objc_declaration): Likewise.
+	(cp_parser_objc_try_catch_finally_statement): Likewise.
+	(cp_parser_objc_synchronized_statement): Likewise.
+	(cp_parser_objc_throw_statement): Likewise.
+	(cp_parser_objc_statement): Likewise.
+	(cp_parser_primary_expression): Add Objective-C++.
+	(cp_parser_statement): Likewise.
+	(cp_parser_declaration): Likewise.
+	(cp_parser_simple_type_specifier): Likewise.
+	(cp_parser_type_name): Likewise.
+	(cp_parser_parameter_declaration_list): Likewise.
+	(cp_parser_member_declaration) Likewise.
+	* tree.c: Include debug.h.
+	* typeck.c (composite_pointer_type): Add Objective-C++ support.
+	(finish_class_member_access_expr): Likewise.
+	(build_function_call): Allow objc to rewrite FUNCTION_DECLs.
+	(build_modify_expr): Allow objc to generate write barriers.
+
+	* Make-lang.in (cp/tree.o): Add debug.h.
+	* tree.c (lvalue_p_1, case CONST_DECL): Add.
+
 2005-05-17  Jakub Jelinek  <jakub@redhat.com>
 
 	PR c++/21454


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