A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Sun Dec 17 06:33: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 empty function compilation at -O0 level:
    Overall memory needed: 18277k -> 18281k
    Peak memory use before GGC: 2235k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 293k
    Garbage: 423k -> 422k
    Leak: 2273k
    Overhead: 446k -> 446k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 18293k -> 18297k
    Peak memory use before GGC: 2263k
    Peak memory use after GGC: 1970k
    Maximum of released memory in single GGC run: 293k
    Garbage: 425k -> 425k
    Leak: 2305k
    Overhead: 450k -> 450k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 18381k
    Peak memory use before GGC: 2235k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 293k
    Garbage: 427k -> 427k
    Leak: 2275k
    Overhead: 446k -> 446k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 18393k
    Peak memory use before GGC: 2236k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 294k
    Garbage: 430k -> 430k
    Leak: 2275k
    Overhead: 447k -> 447k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 18393k
    Peak memory use before GGC: 2236k
    Peak memory use after GGC: 1942k
    Maximum of released memory in single GGC run: 294k
    Garbage: 430k -> 430k
    Leak: 2275k
    Overhead: 447k -> 447k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 28437k
    Peak memory use before GGC: 9287k
    Peak memory use after GGC: 8804k
    Maximum of released memory in single GGC run: 2641k
    Garbage: 37502k -> 37501k
    Leak: 6455k -> 6454k
    Overhead: 4869k -> 4867k
    GGC runs: 280

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 30521k
    Peak memory use before GGC: 10834k
    Peak memory use after GGC: 10464k
    Maximum of released memory in single GGC run: 2360k
    Garbage: 38077k -> 38076k
    Leak: 9331k -> 9330k
    Overhead: 5570k -> 5569k
    GGC runs: 272

comparing combine.c compilation at -O1 level:
    Overall memory needed: 29474k
    Peak memory use before GGC: 16979k
    Peak memory use after GGC: 16792k
    Maximum of released memory in single GGC run: 2254k
    Garbage: 55685k -> 55684k
    Leak: 6489k
    Overhead: 10562k -> 10560k
    GGC runs: 360

comparing combine.c compilation at -O2 level:
    Overall memory needed: 29474k
    Peak memory use before GGC: 16988k
    Peak memory use after GGC: 16792k
    Maximum of released memory in single GGC run: 2611k
    Garbage: 71699k -> 71697k
    Leak: 6611k
    Overhead: 12536k -> 12535k
    GGC runs: 413

comparing combine.c compilation at -O3 level:
    Overall memory needed: 29602k
    Peak memory use before GGC: 18226k
    Peak memory use after GGC: 17749k
    Maximum of released memory in single GGC run: 4564k
    Garbage: 106169k -> 106165k
    Leak: 6688k
    Overhead: 17998k -> 17995k
    GGC runs: 463

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 89650k
    Peak memory use before GGC: 71193k
    Peak memory use after GGC: 44699k
    Maximum of released memory in single GGC run: 37868k
    Garbage: 132105k -> 132105k
    Leak: 9518k -> 9518k
    Overhead: 16952k -> 16951k
    GGC runs: 211

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 90826k
    Peak memory use before GGC: 72354k
    Peak memory use after GGC: 45967k
    Maximum of released memory in single GGC run: 37868k
    Garbage: 133512k -> 133511k
    Leak: 10982k -> 10981k
    Overhead: 17347k -> 17347k
    GGC runs: 209

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 96050k -> 96058k
    Peak memory use before GGC: 73119k
    Peak memory use after GGC: 70764k
    Maximum of released memory in single GGC run: 31671k
    Garbage: 229861k -> 229860k
    Leak: 9343k
    Overhead: 31154k -> 31153k
    GGC runs: 226

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 128386k
    Peak memory use before GGC: 78731k
    Peak memory use after GGC: 76200k
    Maximum of released memory in single GGC run: 30216k
    Garbage: 282674k -> 282673k
    Leak: 9345k
    Overhead: 37707k -> 37706k
    GGC runs: 247

comparing insn-attrtab.c compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 118790k to 128162k, overall 7.89%
    Overall memory needed: 118790k -> 128162k
    Peak memory use before GGC: 78756k
    Peak memory use after GGC: 76226k
    Maximum of released memory in single GGC run: 30410k
    Garbage: 283518k -> 283517k
    Leak: 9350k
    Overhead: 37940k -> 37940k
    GGC runs: 253

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Amount of produced GGC garbage increased from 210224k to 210968k, overall 0.35%
    Overall memory needed: 119066k
    Peak memory use before GGC: 92331k
    Peak memory use after GGC: 91417k
    Maximum of released memory in single GGC run: 19252k
    Garbage: 210224k -> 210968k
    Leak: 48133k -> 48116k
    Overhead: 20979k -> 21034k
    GGC runs: 413 -> 414

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
  Amount of produced GGC garbage increased from 216791k to 217553k, overall 0.35%
    Overall memory needed: 131642k
    Peak memory use before GGC: 104696k
    Peak memory use after GGC: 103652k
    Maximum of released memory in single GGC run: 18947k
    Garbage: 216791k -> 217553k
    Leak: 71564k -> 71548k
    Overhead: 26883k -> 26939k
    GGC runs: 384 -> 388

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Amount of produced GGC garbage increased from 442072k to 442829k, overall 0.17%
    Overall memory needed: 120074k -> 119502k
    Peak memory use before GGC: 96748k -> 96665k
    Peak memory use after GGC: 94462k
    Maximum of released memory in single GGC run: 17941k -> 17940k
    Garbage: 442072k -> 442829k
    Leak: 50198k -> 50182k
    Overhead: 107727k -> 107697k
    GGC runs: 565 -> 566

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Amount of produced GGC garbage increased from 497136k to 497828k, overall 0.14%
    Overall memory needed: 120134k -> 119554k
    Peak memory use before GGC: 96776k -> 96692k
    Peak memory use after GGC: 94490k -> 94489k
    Maximum of released memory in single GGC run: 18082k -> 18081k
    Garbage: 497136k -> 497828k
    Leak: 51167k -> 51150k
    Overhead: 63569k -> 63539k
    GGC runs: 621 -> 622

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Amount of produced GGC garbage increased from 517507k to 518190k, overall 0.13%
    Overall memory needed: 121934k -> 121138k
    Peak memory use before GGC: 97765k -> 97648k
    Peak memory use after GGC: 96144k
    Maximum of released memory in single GGC run: 18476k
    Garbage: 517507k -> 518190k
    Leak: 51140k -> 51123k
    Overhead: 63491k -> 63458k
    GGC runs: 625

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 137302k -> 137646k
    Peak memory use before GGC: 81587k
    Peak memory use after GGC: 58467k
    Maximum of released memory in single GGC run: 45167k
    Garbage: 148513k -> 148513k
    Leak: 7542k -> 7542k
    Overhead: 25327k -> 25327k
    GGC runs: 82

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 138014k
    Peak memory use before GGC: 82233k
    Peak memory use after GGC: 59113k
    Maximum of released memory in single GGC run: 45232k
    Garbage: 148724k -> 148723k
    Leak: 9309k -> 9309k
    Overhead: 25823k -> 25823k
    GGC runs: 88

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 428046k -> 423798k
    Peak memory use before GGC: 205843k
    Peak memory use after GGC: 200073k
    Maximum of released memory in single GGC run: 99748k
    Garbage: 283818k -> 283746k
    Leak: 29778k
    Overhead: 36217k -> 36143k
    GGC runs: 97

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 355586k
    Peak memory use before GGC: 205836k -> 205840k
    Peak memory use after GGC: 200066k -> 200070k
    Maximum of released memory in single GGC run: 96120k -> 96116k
    Garbage: 364426k -> 364347k
    Leak: 30361k
    Overhead: 51967k -> 51892k
    GGC runs: 105

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 769718k -> 770098k
    Peak memory use before GGC: 327243k
    Peak memory use after GGC: 304885k
    Maximum of released memory in single GGC run: 168283k
    Garbage: 504514k -> 504429k
    Leak: 45414k
    Overhead: 66989k -> 66903k
    GGC runs: 97

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2006-12-16 08:25:19.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2006-12-17 04:35:38.000000000 +0000
@@ -1,3 +1,41 @@
+2006-12-16  Jan Hubicka  <jh@suse.cz>
+
+	* cgraphunit.c (ipa_passes): Clear current_function_decl.
+
+2006-12-16  Andreas Tobler  <a.tobler@schweiz.org>
+
+	* passes.c (verify_curr_properties): Define only for ENABLE_CHECKING.
+
+2006-12-16  Jan Hubicka  <jh@suse.cz>
+
+	* omp-low.c (expand_omp_parallel): Set function properties.
+	* function.h (struct function): Add curr_properties and last_verified.
+	* passes.c (register_dump_files): Do not set TODO_set_props for the
+	first pass
+	(init_optimization_passes): Set it here; reorder initialization so the
+	dump files appear in more logical order.
+	(last_verified, curr_properties): Kill.
+	(do_per_function): New function.
+	(execute_function_todo): Break out from ...
+	(execute_todo): ... here; handle per-function flags.
+	(clear_last_verified, verify_curr_properties,
+	update_properties_after_pass): New functions.
+	(execute_one_pass): Handle per-function properties.
+	(execute_ipa_pass_list): Use do_per_function; sanity check that cfun
+	and current_function_decls are cleared out.
+	* ipa-cp.c (constant_val_insert): Clear cfun/current_function_decl
+	after use.
+
+2006-12-16  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+	PR middle-end/7651
+	* c.opt (Wempty-body): New.
+	* doc/invoke.texi (Wempty-body): Document it.
+	(Wextra): Enabled by -Wextra.
+	* c-opts.c (c_common_post_options): Enabled by -Wextra.
+	* c-common.c (empty_body_warning): Replace Wextra with Wempty-body.
+	* c-parser.c (c_parser_c99_block_statement): Likewise.
+	
 2006-12-15  Jakub Jelinek  <jakub@redhat.com>
 
 	PR target/30185
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2006-12-14 18:37:11.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2006-12-17 04:35:38.000000000 +0000
@@ -1,3 +1,71 @@
+2006-12-16  Simon Martin  <simartin@users.sourceforge.net>
+
+	PR c++/29475
+	* cp-tree.h (struct deferred_access_check): New structure to represent a
+	deferred access check. It replaces the previous representation as a tree.
+	(get_deferred_access_checks): Return a vector of struct
+	deferred_access_check instead of a tree list.
+	(perform_access_checks): Take a vector of struct deferred_access_check
+	instead of a tree list.
+	* semantics.c (struct deferred_access): Store the deferred access checks
+	as a vector of struct deferred_access_check instead of a tree list.
+	(push_deferring_access_checks): Handle the change in struct
+	deferred_access.
+	(get_deferred_access_checks): Likewise.
+	(pop_to_parent_deferring_access_checks): Likewise.
+	(perform_or_defer_access_check): Likewise.
+	(perform_access_checks): Take a vector of struct deferred_access_check
+	instead of a tree list.
+	* parser.c (struct tree_check): New structure to store various data
+	associated with a CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID token.
+	(struct cp_token): Changed the value field to be a union with a pointer to
+	a struct tree_check for CPP_NESTED_NAME_SPECIFIER or CPP_TEMPLATE_ID
+	tokens and a tree field for all other tokens.
+	(eof_token): Adjusted due to the change in struct cp_token.
+	(cp_lexer_get_preprocessor_token): Likewise.
+	(cp_lexer_purge_token): Likewise.
+	(cp_lexer_purge_tokens_after): Likewise.
+	(cp_lexer_print_token): Likewise.
+	(cp_parser_error): Likewise.
+	(cp_parser_identifier): Likewise.
+	(cp_parser_string_literal): Likewise.
+	(cp_parser_primary_expression): Likewise.
+	(cp_parser_unqualified_id): Likewise.
+	(cp_parser_parenthesized_expression_list): Likewise.
+	(cp_parser_storage_class_specifier_opt): Likewise.
+	(cp_parser_function_specifier_opt): Likewise.
+	(cp_parser_type_specifier): Likewise.
+	(cp_parser_simple_type_specifier): Likewise.
+	(cp_parser_initializer_list): Likewise.
+	(cp_parser_member_specification_opt): Likewise.
+	(cp_parser_attribute_list): Likewise.
+	(cp_parser_objc_expression): Likewise.
+	(cp_parser_objc_protocol_qualifiers): Likewise.
+	(cp_parser_objc_selector): Likewise.
+	(cp_parser_objc_declaration): Likewise.
+	(cp_parser_objc_statement): Likewise.
+	(cp_parser_omp_clause_name): Likewise.
+	(cp_parser_omp_clause_default): Likewise.
+	(cp_parser_omp_clause_schedule): Likewise.
+	(cp_parser_omp_parallel): Likewise.
+	(cp_parser_initial_pragma): Likewise.
+	(pragma_lex): Likewise.
+	(cp_parser_pre_parsed_nested_name_specifier): Likewise.
+	(cp_parser_nested_name_specifier_opt): Likewise.
+	Use cp_token::u::tree_check_value to save the token's value, the
+	associated deferred checks and its qualifying scope.
+	(cp_parser_template_id): Likewise.
+	(cp_parser_template_declaration_after_export): Adjusted the call to
+	get_deferred_access_checks.
+	(cp_parser_init_declarator): Take the access checks as a vector of struct
+	deferred_access_check instead of a tree list.
+	(cp_parser_single_declaration): Likewise.
+	(cp_parser_perform_template_parameter_access_checks): Likewise.
+	(cp_parser_simple_declaration): Adjusted the call to
+	cp_parser_init_declarator.
+	(cp_parser_explicit_specialization): Adjusted the call to
+	cp_parser_single_declaration.
+
 2006-12-13  Ian Lance Taylor  <iant@google.com>
 
 	PR c++/19564


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