This is the mail archive of the gcc-regression@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A recent patch increased GCC's memory consumption!


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: 8331k -> 8330k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3043k
    Maximum of released memory in single GGC run: 353k
    Garbage: 525k
    Leak: 3798k
    Overhead: 915k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 8347k -> 8346k
    Peak memory use before GGC: 3423k
    Peak memory use after GGC: 3071k
    Maximum of released memory in single GGC run: 352k
    Garbage: 527k
    Leak: 3831k
    Overhead: 919k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 8387k -> 8386k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3043k
    Maximum of released memory in single GGC run: 353k
    Garbage: 527k
    Leak: 3799k
    Overhead: 915k
    GGC runs: 3

comparing empty function compilation at -O2 level:
    Overall memory needed: 8391k -> 8394k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3044k
    Maximum of released memory in single GGC run: 352k
    Garbage: 531k
    Leak: 3800k
    Overhead: 916k
    GGC runs: 3

comparing empty function compilation at -O3 level:
    Overall memory needed: 8391k -> 8394k
    Peak memory use before GGC: 3396k
    Peak memory use after GGC: 3044k
    Maximum of released memory in single GGC run: 352k
    Garbage: 531k
    Leak: 3800k
    Overhead: 916k
    GGC runs: 3

comparing combine.c compilation at -O0 level:
    Overall memory needed: 23755k -> 23754k
    Peak memory use before GGC: 10323k
    Peak memory use after GGC: 9567k
    Maximum of released memory in single GGC run: 1903k
    Garbage: 39067k
    Leak: 8856k
    Overhead: 5786k
    GGC runs: 254

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 25623k -> 25622k
    Peak memory use before GGC: 11984k
    Peak memory use after GGC: 11358k
    Maximum of released memory in single GGC run: 1516k
    Garbage: 39437k
    Leak: 11749k
    Overhead: 6492k
    GGC runs: 250

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35735k -> 35738k
    Peak memory use before GGC: 18984k
    Peak memory use after GGC: 18794k
    Maximum of released memory in single GGC run: 1375k
    Garbage: 52588k
    Leak: 8994k
    Overhead: 6749k
    GGC runs: 321

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37751k -> 37754k
    Peak memory use before GGC: 19038k
    Peak memory use after GGC: 18848k
    Maximum of released memory in single GGC run: 1410k
    Garbage: 70990k
    Leak: 9322k
    Overhead: 8864k
    GGC runs: 383

comparing combine.c compilation at -O3 level:
    Overall memory needed: 40559k -> 40558k
    Peak memory use before GGC: 19313k
    Peak memory use after GGC: 18965k
    Maximum of released memory in single GGC run: 2261k
    Garbage: 92929k
    Leak: 9434k
    Overhead: 11492k
    GGC runs: 412

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 140103k -> 140102k
    Peak memory use before GGC: 60580k
    Peak memory use after GGC: 34074k
    Maximum of released memory in single GGC run: 34143k
    Garbage: 132016k
    Leak: 11586k
    Overhead: 15589k
    GGC runs: 197

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 141355k -> 141358k
    Peak memory use before GGC: 61742k
    Peak memory use after GGC: 35235k
    Maximum of released memory in single GGC run: 34144k
    Garbage: 132500k
    Leak: 13040k
    Overhead: 15986k
    GGC runs: 199

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 150223k -> 150222k
    Peak memory use before GGC: 59101k
    Peak memory use after GGC: 52850k
    Maximum of released memory in single GGC run: 24232k
    Garbage: 212962k
    Leak: 12480k
    Overhead: 25582k
    GGC runs: 222

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 188903k -> 188910k
    Peak memory use before GGC: 59723k
    Peak memory use after GGC: 54429k
    Maximum of released memory in single GGC run: 22887k
    Garbage: 254073k
    Leak: 13562k
    Overhead: 31305k
    GGC runs: 249

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 195879k -> 195878k
    Peak memory use before GGC: 71708k
    Peak memory use after GGC: 65141k
    Maximum of released memory in single GGC run: 23330k
    Garbage: 281238k
    Leak: 13573k
    Overhead: 33104k
    GGC runs: 252

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Peak amount of GGC memory allocated before garbage collecting increased from 91630k to 91852k, overall 0.24%
  Peak amount of GGC memory still allocated after garbage collecting increased from 90713k to 90943k, overall 0.25%
    Overall memory needed: 156557k -> 156933k
    Peak memory use before GGC: 91630k -> 91852k
    Peak memory use after GGC: 90713k -> 90943k
    Maximum of released memory in single GGC run: 17988k -> 18215k
    Garbage: 211045k -> 210833k
    Leak: 55684k -> 55681k
    Overhead: 27259k -> 27340k
    GGC runs: 397 -> 394

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
    Overall memory needed: 177765k -> 177445k
    Peak memory use before GGC: 104598k -> 104643k
    Peak memory use after GGC: 103554k -> 103603k
    Maximum of released memory in single GGC run: 18703k -> 18753k
    Garbage: 216895k -> 216695k
    Leak: 79113k -> 79109k
    Overhead: 33227k -> 33309k
    GGC runs: 373

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 135455k -> 135415k
    Peak memory use before GGC: 96351k -> 96347k
    Peak memory use after GGC: 95396k -> 95393k
    Maximum of released memory in single GGC run: 17368k
    Garbage: 320051k -> 319838k
    Leak: 55777k -> 55774k
    Overhead: 33473k -> 33555k
    GGC runs: 497

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 145331k -> 145295k
    Peak memory use before GGC: 96182k -> 96177k
    Peak memory use after GGC: 95229k -> 95224k
    Maximum of released memory in single GGC run: 17372k
    Garbage: 379778k -> 379569k
    Leak: 57068k -> 57064k
    Overhead: 39879k -> 39962k
    GGC runs: 560

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 149039k -> 149099k
    Peak memory use before GGC: 97906k -> 97900k
    Peak memory use after GGC: 96822k -> 96816k
    Maximum of released memory in single GGC run: 17787k -> 17747k
    Garbage: 418045k -> 417838k
    Leak: 57369k -> 57365k
    Overhead: 43180k -> 43271k
    GGC runs: 583

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 381016k
    Peak memory use before GGC: 103476k
    Peak memory use after GGC: 59130k
    Maximum of released memory in single GGC run: 50582k
    Garbage: 179674k
    Leak: 9010k
    Overhead: 31654k
    GGC runs: 65

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 381836k
    Peak memory use before GGC: 104123k
    Peak memory use after GGC: 59776k
    Maximum of released memory in single GGC run: 50583k
    Garbage: 179827k
    Leak: 10778k
    Overhead: 32150k
    GGC runs: 72

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 290227k -> 290218k
    Peak memory use before GGC: 82784k
    Peak memory use after GGC: 75172k
    Maximum of released memory in single GGC run: 40017k
    Garbage: 236071k
    Leak: 18348k
    Overhead: 32719k
    GGC runs: 69

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 279443k -> 277506k
    Peak memory use before GGC: 80159k
    Peak memory use after GGC: 75173k
    Maximum of released memory in single GGC run: 33750k
    Garbage: 246134k
    Leak: 18437k
    Overhead: 34945k
    GGC runs: 82

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1012335k -> 1012334k
    Peak memory use before GGC: 168800k
    Peak memory use after GGC: 158364k
    Maximum of released memory in single GGC run: 83495k
    Garbage: 356480k
    Leak: 28512k
    Overhead: 46899k
    GGC runs: 65

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-08-24 21:37:36.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-08-25 13:26:19.000000000 +0000
@@ -1,3 +1,44 @@
+2007-08-25  Hans Kester  <hans.kester@ellips.nl>
+
+	* config.gcc : Add x86_64-elf target.
+
+2007-08-25  Jakub Jelinek  <jakub@redhat.com>
+
+	* expr.c (store_expr): Fix order of store_by_pieces arguments.
+
+2007-08-24  Sandra Loosemore  <sandra@codesourcery.com>
+            Nigel Stephens <nigel@mips.com>
+
+	PR target/11787
+
+	* doc/tm.texi (SET_RATIO, SET_BY_PIECES_P): Document new macros.
+	(STORE_BY_PIECES_P): No longer applies to __builtin_memset.
+	* expr.c (SET_BY_PIECES_P): Define.
+	(can_store_by_pieces, store_by_pieces): Add MEMSETP argument; use
+	it to decide whether to use SET_BY_PIECES_P or STORE_BY_PIECES_P.
+	(store_expr): Pass MEMSETP argument to can_store_by_pieces and
+	store_by_pieces.
+	* expr.h (SET_RATIO): Define.
+	(can_store_by_pieces, store_by_pieces):	Update prototypes.
+	* builtins.c (expand_builtin_memcpy): Pass MEMSETP argument to
+	can_store_by_pieces/store_by_pieces.
+	(expand_builtin_memcpy_args): Likewise.
+	(expand_builtin_strncpy): Likewise.
+	(expand_builtin_memset_args): Likewise.  Also remove special case
+	for optimize_size so that can_store_by_pieces/SET_BY_PIECES_P can
+	decide what to do instead.
+	* value-prof.c (tree_stringops_transform): Pass MEMSETP argument
+	to can_store_by_pieces.
+
+	* config/sh/sh.h (SET_BY_PIECES_P): Clone from STORE_BY_PIECES_P.
+	* config/s390/s390.h (SET_BY_PIECES_P): Likewise.
+
+	* config/mips/mips.opt (mmemcpy): Change from Var to Mask.
+	* config/mips/mips.c (override_options): Make -Os default to -mmemcpy.
+	* config/mips/mips.h (MIPS_CALL_RATIO): Define.
+	(MOVE_RATIO, CLEAR_RATIO, SET_RATIO): Define.
+	(STORE_BY_PIECES_P): Define.
+
 2007-08-24  Tom Tromey  <tromey@redhat.com>
 
 	* varpool.c (varpool_last_needed_node): Fix comment typo.
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-08-24 21:37:32.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-08-25 13:26:17.000000000 +0000
@@ -1,3 +1,36 @@
+2007-08-25  Paolo Bonzini  <bonzini@gnu.org>
+
+	* decl.c (cp_tree_node_structure): Kill TINST_LEVEL case.
+	* cp-objcp-common.c (cp_tree_size): Ditto.
+	* tree.c (cp_walk_subtrees): Ditto
+	* cp-tree.def (TINST_LEVEL): Go away.
+	* cp-tree.h (struct tinst_level_s): Rename to struct tinst_level,
+	move together with other non-tree structs.
+	(enum cp_tree_node_structure_enum): Nuke TS_CP_TINST_LEVEL.
+	(union lang_tree_node): Eliminate tinst_level field.
+	(TINST_DECL, TINST_LOCATION, TINST_IN_SYSTEM_HEADER_P): Annihilate.
+	(current_instantiation, outermost_tinst_level): Return
+	a "struct tinst_level *".
+
+	* error.c (print_instantiation_partial_context): Change second
+	parameter to a "struct tinst_level *".  Replace accessor macros
+	with field access.
+	(print_instantiation_full_context): Likewise.
+	* lex.c (in_main_input_context): Likewise.
+
+	* pt.c (struct pending_templates): New.
+	(pending_templates, last_pending_template): Use it as a type.
+	(current_tinst_level): Change typo to "struct tinst_level *"
+	(reopen_tinst_level): Accept "struct tinst_level *", return decl.
+	(add_pending_template): Construct a "struct pending_template".
+	Replace TINST_LEVEL accessor macros with field access.
+	(push_tinst_level): Likewise, using GGC_NEW instead of make_node.
+	(pop_tinst_level): Likewise.
+	(instantiate_pending_templates): Likewise.  Factor common code used
+	when an instantiation has been done.
+	(outermost_tinst_level): Replace tree_last with loop.
+	(current_instantiation): Return a "struct tinst_level *".
+
 2007-08-24  Ollie Wild  <aaw@google.com>
 
 	* name-lookup.c (add_decl_to_level): Remove addition to vtables chain.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]