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

Jan Hubicka jh@suse.cz
Mon Jan 22 01:10:00 GMT 2007


> 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:

Hmm, this is curious development, since the patch just reduced size of
stmt annotation.  Since stmt annotation is special cased in
extra_order_size_table, GGC now increased overhead in some cases but
specially it affected way we grow very small arrays.

Nothing of this is terribly critical, but I will check if I can
dobetter.

Honza
> 
> comparing combine.c compilation at -O1 level:
>   Ovarall memory allocated via mmap and sbrk decreased from 34540k to 33032k, overall -4.57%
>     Overall memory needed: 34540k -> 33032k
>     Peak memory use before GGC: 19926k -> 19645k
>     Peak memory use after GGC: 19728k -> 19446k
>     Maximum of released memory in single GGC run: 2261k
>     Garbage: 55011k -> 54611k
>     Leak: 6568k -> 6569k
>     Overhead: 9903k -> 9667k
>     GGC runs: 348 -> 352
> 
> comparing combine.c compilation at -O2 level:
>   Ovarall memory allocated via mmap and sbrk decreased from 38028k to 36512k, overall -4.15%
>     Overall memory needed: 38028k -> 36512k
>     Peak memory use before GGC: 19937k -> 19649k
>     Peak memory use after GGC: 19736k -> 19454k
>     Maximum of released memory in single GGC run: 2203k -> 2202k
>     Garbage: 70936k -> 70388k
>     Leak: 6681k -> 6682k
>     Overhead: 11767k -> 11477k
>     GGC runs: 406 -> 410
> 
> 
> comparing insn-attrtab.c compilation at -O3 level:
>   Overall memory allocated via mmap and sbrk increased from 186436k to 192148k, overall 3.06%
>     Overall memory needed: 186436k -> 192148k
>     Peak memory use before GGC: 79796k -> 78349k
>     Peak memory use after GGC: 74026k -> 72729k
>     Maximum of released memory in single GGC run: 30597k -> 30596k
>     Garbage: 281705k -> 278669k
>     Leak: 9397k -> 9399k
>     Overhead: 35982k -> 34519k
>     GGC runs: 246
> 
> comparing Gerald's testcase PR8361 compilation at -O0 level:
>   Amount of produced GGC garbage increased from 208371k to 209166k, overall 0.38%
>   Amount of memory still referenced at the end of compilation increased from 49079k to 49262k, overall 0.37%
>     Overall memory needed: 152267k -> 151631k
>     Peak memory use before GGC: 93134k -> 92618k
>     Peak memory use after GGC: 92212k -> 91701k
>     Maximum of released memory in single GGC run: 18949k -> 18916k
>     Garbage: 208371k -> 209166k
>     Leak: 49079k -> 49262k
>     Overhead: 21256k -> 21473k
>     GGC runs: 407 -> 409
> 
> comparing Gerald's testcase PR8361 compilation at -O0 -g level:
>   Amount of produced GGC garbage increased from 214942k to 215792k, overall 0.40%
>   Amount of memory still referenced at the end of compilation increased from 72503k to 72687k, overall 0.25%
>     Overall memory needed: 169783k -> 169735k
>     Peak memory use before GGC: 105410k -> 105241k
>     Peak memory use after GGC: 104366k -> 104198k
>     Maximum of released memory in single GGC run: 18788k -> 19093k
>     Garbage: 214942k -> 215792k
>     Leak: 72503k -> 72687k
>     Overhead: 27159k -> 27396k
>     GGC runs: 382 -> 383
> 
> comparing Gerald's testcase PR8361 compilation at -O1 level:
>   Amount of memory still referenced at the end of compilation increased from 50001k to 50202k, overall 0.40%
>     Overall memory needed: 139489k -> 138161k
>     Peak memory use before GGC: 98490k -> 98469k
>     Peak memory use after GGC: 97488k -> 97467k
>     Maximum of released memory in single GGC run: 17979k -> 18086k
>     Garbage: 401548k -> 401813k
>     Leak: 50001k -> 50202k
>     Overhead: 55153k -> 55484k
>     GGC runs: 548 -> 545
> 
> comparing Gerald's testcase PR8361 compilation at -O2 level:
>   Amount of memory still referenced at the end of compilation increased from 50799k to 50999k, overall 0.40%
>     Overall memory needed: 141453k -> 140117k
>     Peak memory use before GGC: 98529k -> 98508k
>     Peak memory use after GGC: 97553k -> 97532k
>     Maximum of released memory in single GGC run: 17979k -> 18077k
>     Garbage: 459721k -> 459563k
>     Leak: 50799k -> 50999k
>     Overhead: 48325k -> 48510k
>     GGC runs: 598 -> 596
> 
> comparing Gerald's testcase PR8361 compilation at -O3 level:
>   Amount of memory still referenced at the end of compilation increased from 51414k to 51670k, overall 0.50%
>     Overall memory needed: 144225k -> 142865k
>     Peak memory use before GGC: 100283k -> 100219k
>     Peak memory use after GGC: 99240k -> 99222k
>     Maximum of released memory in single GGC run: 18336k -> 18473k
>     Garbage: 487226k -> 487014k
>     Leak: 51414k -> 51670k
>     Overhead: 50299k -> 50501k
>     GGC runs: 614 -> 613
> 
> comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
>     Overall memory needed: 246452k -> 246444k
>     Peak memory use before GGC: 82630k
>     Peak memory use after GGC: 59510k
>     Maximum of released memory in single GGC run: 45582k
>     Garbage: 148155k -> 148155k
>     Leak: 8080k -> 8081k
>     Overhead: 25066k -> 24863k
>     GGC runs: 80
> 
> comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
>     Overall memory needed: 247348k -> 247352k
>     Peak memory use before GGC: 83276k
>     Peak memory use after GGC: 60156k
>     Maximum of released memory in single GGC run: 45231k
>     Garbage: 148325k -> 148386k
>     Leak: 9336k -> 9336k
>     Overhead: 25561k -> 25359k
>     GGC runs: 88
> 
> comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
>   Amount of memory still referenced at the end of compilation increased from 27473k to 28011k, overall 1.96%
>     Overall memory needed: 315332k -> 312156k
>     Peak memory use before GGC: 197757k -> 195999k
>     Peak memory use after GGC: 178756k -> 176840k
>     Maximum of released memory in single GGC run: 134210k -> 132183k
>     Garbage: 274307k -> 270497k
>     Leak: 27473k -> 28011k
>     Overhead: 33210k -> 32233k
>     GGC runs: 74
> 
> comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
>   Amount of memory still referenced at the end of compilation increased from 27902k to 28440k, overall 1.93%
>     Overall memory needed: 301876k -> 297420k
>     Peak memory use before GGC: 302461k -> 302730k
>     Peak memory use after GGC: 178747k -> 176830k
>     Maximum of released memory in single GGC run: 241049k
>     Garbage: 586865k -> 583054k
>     Leak: 27902k -> 28440k
>     Overhead: 95381k -> 94404k
>     GGC runs: 83
> 
> comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
>   Amount of memory still referenced at the end of compilation increased from 48594k to 50425k, overall 3.77%
>     Overall memory needed: 1414084k -> 1412120k
>     Peak memory use before GGC: 283520k -> 280853k
>     Peak memory use after GGC: 276538k -> 273871k
>     Maximum of released memory in single GGC run: 138347k -> 114236k
>     Garbage: 451542k -> 446067k
>     Leak: 48594k -> 50425k
>     Overhead: 56810k -> 55125k
>     GGC runs: 73 -> 74
> 
> Head of the ChangeLog is:
> 
> --- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-01-20 18:28:26.000000000 +0000
> +++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-01-21 04:30:58.000000000 +0000
> @@ -1,3 +1,18 @@
> +2007-01-20  Roger Sayle  <roger@eyesopen.com>
> +	    Joseph Myers  <joseph@codesourcery.com>
> +
> +	* doc/invoke.texi (-fdump-rtl-combine): Fix under/overfull hbox.
> +	(-fdump-rtl-stack): Likewise.
> +	(-fno-signed-zeros): Use @minus{} for a minus sign.  Correct typo.
> +	(-mcheck-zero-division, -mcpu): Fix under/overfull hbox.
> +	(-mpt-fixed): Use @minus{} for minus sign.
> +	(Using Precompiled Headers): Fix under/overfull hbox.
> +
> +2007-01-20  Jan Hubicka  <jh@suse.cz>
> +
> +	* tree-flow.h (struct stmt_ann_d): Move references_memory to proper
> +	place within annotation.
> +
>  2007-01-20  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
>  
>  	* pa.c (output_move_double): Change array size of xoperands to 4.
> 
> 
> 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