A recent patch increased GCC's memory consumption!

gcctest@suse.de gcctest@suse.de
Tue Mar 7 08:52: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: 25276k -> 25280k
    Peak memory use before GGC: 9567k
    Peak memory use after GGC: 8914k -> 8915k
    Maximum of released memory in single GGC run: 2648k -> 2649k
    Garbage: 40068k -> 40061k
    Leak: 6741k -> 6741k
    Overhead: 5738k -> 5738k
    GGC runs: 313

comparing combine.c compilation at -O1 level:
    Overall memory needed: 26892k -> 26896k
    Peak memory use before GGC: 17438k
    Peak memory use after GGC: 17259k
    Maximum of released memory in single GGC run: 2318k -> 2317k
    Garbage: 61617k -> 61618k
    Leak: 6881k -> 6882k
    Overhead: 7268k -> 7268k
    GGC runs: 388 -> 387

comparing combine.c compilation at -O2 level:
    Overall memory needed: 26900k
    Peak memory use before GGC: 17441k
    Peak memory use after GGC: 17259k
    Maximum of released memory in single GGC run: 2409k -> 2410k
    Garbage: 81199k -> 81200k
    Leak: 6974k -> 6974k
    Overhead: 9887k -> 9887k
    GGC runs: 456

comparing combine.c compilation at -O3 level:
    Overall memory needed: 26900k
    Peak memory use before GGC: 18509k -> 18459k
    Peak memory use after GGC: 18003k
    Maximum of released memory in single GGC run: 3561k -> 3560k
    Garbage: 111753k -> 111753k
    Leak: 7055k -> 7056k
    Overhead: 13487k -> 13487k
    GGC runs: 514

comparing insn-attrtab.c compilation at -O0 level:
  Amount of produced GGC garbage increased from 146428k to 146683k, overall 0.17%
    Overall memory needed: 80952k -> 80948k
    Peak memory use before GGC: 69509k
    Peak memory use after GGC: 45045k -> 45046k
    Maximum of released memory in single GGC run: 36220k
    Garbage: 146428k -> 146683k
    Leak: 10132k -> 9909k
    Overhead: 19750k -> 19751k
    GGC runs: 247

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 108264k -> 108240k
    Peak memory use before GGC: 91300k -> 91301k
    Peak memory use after GGC: 80536k -> 80537k
    Maximum of released memory in single GGC run: 32511k
    Garbage: 290789k -> 290789k
    Leak: 10074k -> 10074k
    Overhead: 34652k -> 34651k
    GGC runs: 244

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 111016k -> 111024k
    Peak memory use before GGC: 97742k -> 97745k
    Peak memory use after GGC: 84229k -> 84231k
    Maximum of released memory in single GGC run: 32084k
    Garbage: 346099k -> 346096k
    Leak: 10057k -> 10057k
    Overhead: 44310k -> 44310k
    GGC runs: 273

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 111120k -> 111100k
    Peak memory use before GGC: 97772k
    Peak memory use after GGC: 84258k -> 84259k
    Maximum of released memory in single GGC run: 32420k
    Garbage: 346734k
    Leak: 10061k -> 10061k
    Overhead: 44506k -> 44506k
    GGC runs: 279

comparing Gerald's testcase PR8361 compilation at -O0 level:
    Overall memory needed: 118252k
    Peak memory use before GGC: 95028k
    Peak memory use after GGC: 94080k
    Maximum of released memory in single GGC run: 20299k
    Garbage: 223451k -> 223449k
    Leak: 49470k -> 49471k
    Overhead: 37086k -> 37085k
    GGC runs: 369

comparing Gerald's testcase PR8361 compilation at -O1 level:
    Overall memory needed: 108456k
    Peak memory use before GGC: 95144k
    Peak memory use after GGC: 93152k
    Maximum of released memory in single GGC run: 20158k
    Garbage: 559381k -> 559396k
    Leak: 53307k -> 53307k
    Overhead: 62175k -> 62173k
    GGC runs: 525 -> 524

comparing Gerald's testcase PR8361 compilation at -O2 level:
    Overall memory needed: 111080k
    Peak memory use before GGC: 95144k
    Peak memory use after GGC: 93152k -> 93153k
    Maximum of released memory in single GGC run: 20158k
    Garbage: 685883k -> 685869k
    Leak: 54384k -> 54385k
    Overhead: 75155k -> 75155k
    GGC runs: 608 -> 607

comparing Gerald's testcase PR8361 compilation at -O3 level:
    Overall memory needed: 110776k -> 110768k
    Peak memory use before GGC: 96538k
    Peak memory use after GGC: 94580k
    Maximum of released memory in single GGC run: 20583k -> 20582k
    Garbage: 746930k -> 746934k
    Leak: 55481k -> 55482k
    Overhead: 79215k -> 79215k
    GGC runs: 629

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2006-03-06 22:07:50.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2006-03-07 08:43:27.000000000 +0000
@@ -1,3 +1,29 @@
+2006-03-07  Richard Sandiford  <richard@codesourcery.com>
+
+	* hooks.c (hook_bool_mode_rtx_true): New function.
+	* hooks.h (hook_bool_mode_rtx_true): Declare.
+	* toplev.c (compile_file): Call output_shared_constant_pool.
+	* varasm.c (shared_constant_pool): New variable.
+	(assemble_start_function, assemble_end_function): Remove arguments
+	from call to output_constant_pool.
+	(create_constant_pool): New function, split out from...
+	(init_varasm_status): ...here.
+	(force_const_mem): Choose between the shared and per-function constant
+	pools.  Set current_function_uses_const_pool when reusing old entries
+	as well as when creating new ones.
+	(mark_constant): Ignore data argument.
+	(mark_constants): Remove pool argument.
+	(mark_constant_pool): Likewise.  Use current_function_uses_const_pool
+	to decide whether the function uses a constant pool.
+	(output_constant_pool_contents): New function, split out from...
+	(output_constant_pool): ...here.
+	(output_shared_constant_pool): New function.
+	(init_varasm_once): Initialize shared_constant_pool.
+	* output.h (output_constant_pool): Delete.
+	(output_shared_constant_pool): Declare.
+	* config/s390/s390-protos.h (s390_output_constant_pool): Delete.
+	* config/i386/i386.c (TARGET_USE_BLOCKS_FOR_CONSTANT_P): Override.
+
 2006-03-06  Nick Clifton  <nickc@redhat.com>
 
 	* config/m32r/m32r.h (OPTIMIZATION_OPTIONS): Remove reference to


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