This is the mail archive of the
gcc-regression@gcc.gnu.org
mailing list for the GCC project.
A recent patch increased GCC's memory consumption in some cases!
- From: gcctest at suse dot de
- To: jh at suse dot cz, gcc-regression at gcc dot gnu dot org
- Date: Tue, 28 Jun 2005 03:21:48 +0000
- Subject: A recent patch increased GCC's memory consumption in some cases!
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: 24896k
Peak memory use before GGC: 9717k
Peak memory use after GGC: 9064k
Maximum of released memory in single GGC run: 2815k
Garbage: 42310k
Leak: 6721k
Overhead: 5842k
GGC runs: 334
comparing combine.c compilation at -O1 level:
Peak amount of GGC memory allocated before garbage collecting increased from 17699k to 17735k, overall 0.20%
Amount of produced GGC garbage increased from 67468k to 67688k, overall 0.33%
Overall memory needed: 24240k -> 24376k
Peak memory use before GGC: 17699k -> 17735k
Peak memory use after GGC: 17518k
Maximum of released memory in single GGC run: 2364k -> 2363k
Garbage: 67468k -> 67688k
Leak: 7031k -> 7033k
Overhead: 8384k -> 8420k
GGC runs: 417 -> 416
comparing combine.c compilation at -O2 level:
Peak amount of GGC memory allocated before garbage collecting increased from 17696k to 17743k, overall 0.27%
Amount of produced GGC garbage increased from 86783k to 86965k, overall 0.21%
Overall memory needed: 24244k -> 24368k
Peak memory use before GGC: 17696k -> 17743k
Peak memory use after GGC: 17518k
Maximum of released memory in single GGC run: 2512k
Garbage: 86783k -> 86965k
Leak: 7210k -> 7214k
Overhead: 11125k -> 11157k
GGC runs: 484 -> 478
comparing combine.c compilation at -O3 level:
Peak amount of GGC memory allocated before garbage collecting increased from 17695k to 17990k, overall 1.67%
Peak amount of GGC memory still allocated after garbage collectin increased from 17518k to 17578k, overall 0.34%
Amount of produced GGC garbage increased from 115602k to 115875k, overall 0.24%
Overall memory needed: 24728k -> 24884k
Peak memory use before GGC: 17695k -> 17990k
Peak memory use after GGC: 17518k -> 17578k
Maximum of released memory in single GGC run: 3436k
Garbage: 115602k -> 115875k
Leak: 7305k -> 7289k
Overhead: 14917k -> 14967k
GGC runs: 535 -> 537
comparing insn-attrtab.c compilation at -O0 level:
Overall memory needed: 83372k
Peak memory use before GGC: 71655k
Peak memory use after GGC: 45752k
Maximum of released memory in single GGC run: 37689k
Garbage: 151887k
Leak: 11321k
Overhead: 18884k
GGC runs: 267
comparing insn-attrtab.c compilation at -O1 level:
Peak amount of GGC memory allocated before garbage collecting increased from 98141k to 99596k, overall 1.48%
Peak amount of GGC memory still allocated after garbage collectin increased from 87548k to 89003k, overall 1.66%
Amount of produced GGC garbage increased from 295549k to 296985k, overall 0.49%
Overall memory needed: 115848k -> 117000k
Peak memory use before GGC: 98141k -> 99596k
Peak memory use after GGC: 87548k -> 89003k
Maximum of released memory in single GGC run: 33389k
Garbage: 295549k -> 296985k
Leak: 11440k -> 11434k
Overhead: 36620k -> 36876k
GGC runs: 273 -> 290
comparing insn-attrtab.c compilation at -O2 level:
Peak amount of GGC memory allocated before garbage collecting increased from 117226k to 118682k, overall 1.24%
Peak amount of GGC memory still allocated after garbage collectin increased from 87536k to 88992k, overall 1.66%
Amount of produced GGC garbage increased from 390254k to 391570k, overall 0.34%
Overall memory needed: 155092k -> 157136k
Peak memory use before GGC: 117226k -> 118682k
Peak memory use after GGC: 87536k -> 88992k
Maximum of released memory in single GGC run: 33533k -> 33523k
Garbage: 390254k -> 391570k
Leak: 11520k -> 11523k
Overhead: 48724k -> 48978k
GGC runs: 306 -> 329
comparing insn-attrtab.c compilation at -O3 level:
Peak amount of GGC memory allocated before garbage collecting increased from 117228k to 118684k, overall 1.24%
Peak amount of GGC memory still allocated after garbage collectin increased from 87538k to 88994k, overall 1.66%
Amount of produced GGC garbage increased from 391041k to 392384k, overall 0.34%
Overall memory needed: 155088k -> 157096k
Peak memory use before GGC: 117228k -> 118684k
Peak memory use after GGC: 87538k -> 88994k
Maximum of released memory in single GGC run: 33533k -> 33523k
Garbage: 391041k -> 392384k
Leak: 11540k -> 11532k
Overhead: 48848k -> 49101k
GGC runs: 311 -> 335
comparing Gerald's testcase PR8361 compilation at -O0 level:
Overall memory needed: 124868k
Peak memory use before GGC: 100729k
Peak memory use after GGC: 99725k
Maximum of released memory in single GGC run: 21556k
Garbage: 230059k
Leak: 53186k
Overhead: 40063k
GGC runs: 335
comparing Gerald's testcase PR8361 compilation at -O1 level:
Ovarall memory allocated via mmap and sbrk decreased from 119248k to 107380k, overall -11.05%
Peak amount of GGC memory allocated before garbage collecting run decreased from 110058k to 99640k, overall -10.46%
Amount of produced GGC garbage decreased from 654676k to 439133k, overall -49.08%
Amount of memory still referenced at the end of compilation decreased from 58232k to 55220k, overall -5.45%
Overall memory needed: 119248k -> 107380k
Peak memory use before GGC: 110058k -> 99640k
Peak memory use after GGC: 98650k
Maximum of released memory in single GGC run: 19966k -> 20173k
Garbage: 654676k -> 439133k
Leak: 58232k -> 55220k
Overhead: 89931k -> 63147k
GGC runs: 514 -> 471
comparing Gerald's testcase PR8361 compilation at -O2 level:
Ovarall memory allocated via mmap and sbrk decreased from 119252k to 107380k, overall -11.06%
Peak amount of GGC memory allocated before garbage collecting run decreased from 110059k to 99640k, overall -10.46%
Amount of produced GGC garbage decreased from 749549k to 495446k, overall -51.29%
Amount of memory still referenced at the end of compilation decreased from 59269k to 55858k, overall -6.11%
Overall memory needed: 119252k -> 107380k
Peak memory use before GGC: 110059k -> 99640k
Peak memory use after GGC: 98651k
Maximum of released memory in single GGC run: 19967k -> 20173k
Garbage: 749549k -> 495446k
Leak: 59269k -> 55858k
Overhead: 107685k -> 72718k
GGC runs: 585 -> 517
comparing Gerald's testcase PR8361 compilation at -O3 level:
Ovarall memory allocated via mmap and sbrk decreased from 121560k to 112172k, overall -8.37%
Peak amount of GGC memory allocated before garbage collecting run decreased from 112859k to 100838k, overall -11.92%
Amount of produced GGC garbage decreased from 808374k to 508375k, overall -59.01%
Amount of memory still referenced at the end of compilation decreased from 60594k to 56151k, overall -7.91%
Overall memory needed: 121560k -> 112172k
Peak memory use before GGC: 112859k -> 100838k
Peak memory use after GGC: 99839k
Maximum of released memory in single GGC run: 21384k -> 20573k
Garbage: 808374k -> 508375k
Leak: 60594k -> 56151k
Overhead: 115452k -> 73625k
GGC runs: 597 -> 511
Head of the ChangeLog is:
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog 2005-06-28 01:04:38.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog 2005-06-28 02:22:58.000000000 +0000
@@ -1,3 +1,41 @@
+2005-06-28 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_remove_node): Do not release function bodies until
+ full cgraph is built.
+ * cgraph.h (cgraph_decide_inlining_incrementally): Add early argument.
+ * cgraphunit.c (cgraph_finalize_function): Update call of
+ cgraph_decide_inlining_incrementally.
+ (initialize_inline_failed): Break out of ...
+ (cgraph_analyze_function): ... here.
+ (rebuild_cgraph_edges): New function.
+ (pass_rebuild_cgraph_edges): New pass.
+ * common.opt (fearly-inlining): New flag.
+ * ipa-inline.c: Include ggc.h
+ (cgraph_clone_inlined_nodes): Avoid re-using of original copy
+ when cgraph is not fully built.
+ (cgraph_decide_inlining_incrementally): Add early mode.
+ (cgraph_early_inlining): New function.
+ (cgraph_gate_early_inlining): Likewise.
+ (pass_early_ipa_inline): New pass.
+ * ipa.c (cgraph_postorder): NULLify aux pointer.
+ * tree-inline.c (expand_call_inline): Avoid warning early.
+ * tree-optimize.c (pass_early_local_passes): New.
+ (execute_cleanup_cfg_pre_ipa): New.
+ (pass_cleanup_cfg): New.
+ (register_dump_files): Fix handling subpasses of IPA pass.
+ (init_tree_optimization_passes): Add early passes.
+ (execute_ipa_pass_list): Fix handling of subpasses of IPA pass.
+ * passes.h (pass_early_tree_profile, pass_rebuild_cgraph_edges,
+ pass_early_ipa_inline): New passes.
+ * tree-profile.c (do_early_tree_profiling, pass_early_tree_profile): New.
+
+ * invoke.texi: Document early-inlining.
+
+2005-06-28 Kelley Cook <kcook@gcc.gnu.org>
+
+ * doc/include/fdl.texi: Merge in changes from upstream.
+ * doc/include/gpl.texi: Likewise.
+
2005-06-27 Diego Novillo <dnovillo@redhat.com>
PR 21959
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.