[Bug c++/12850] memory consumption for heavy template instantiations tripled since 3.3

hubicka at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 6 14:13:00 GMT 2008



------- Comment #45 from hubicka at gcc dot gnu dot org  2008-09-06 14:12 -------
Memory footprint in TOP is about 430MB (64bit machine).

On current mainline we need 191MB before IPA. Top consumers
cfg.c:226 (connect_dest)                             598696: 0.2%     180224:
0.5%    3484960: 1.8%     594504: 1.5%      73663
gimple-low.c:806 (record_vars_into)                       0: 0.0%          0:
0.0%    3825552: 2.0%          0: 0.0%      79699
cp/pt.c:8316 (tsubst_decl)                          2244888: 0.9%          0:
0.0%    4552704: 2.4%     357768: 0.9%      44721
tree.c:6061 (build_method_type_directly)            1946600: 0.8%          0:
0.0%    4703200: 2.5%     265992: 0.7%      33249
tree-inline.c:3589 (copy_tree_r)                    9450136: 3.6%          0:
0.0%    4820840: 2.5%    1248128: 3.2%     187483
cfg.c:142 (alloc_block)                             1046016: 0.4%          0:
0.0%    4988448: 2.6%          0: 0.0%      62859
cgraph.c:638 (cgraph_create_edge)                         0: 0.0%          0:
0.0%    5183328: 2.7%          0: 0.0%      53993
gimplify.c:4314 (gimplify_modify_expr)              1185040: 0.5%          0:
0.0%    5570160: 2.9%     304112: 0.8%      57599
gimple-iterator.c:446 (gsi_insert_after_without_    4904480: 1.9%          0:
0.0%    5843840: 3.1%    2149664: 5.5%     268708
cfg.c:280 (unchecked_make_edge)                           0: 0.0%     783288:
2.2%    5930352: 3.1%     745960: 1.9%      93245
gimple.c:287 (gimple_build_call_1)                   871144: 0.3%          0:
0.0%    6066056: 3.2%     247408: 0.6%      51874
tree.c:962 (build_int_cst_wide)                        6096: 0.0%          0:
0.0%    9716432: 5.1%    3187680: 8.1%       2221
gimplify.c:521 (create_tmp_var_raw)                  452760: 0.2%          0:
0.0%   10597944: 5.5%     526224: 1.3%      65778
cp/lex.c:590 (copy_decl)                              26304: 0.0%          0:
0.0%   13586520: 7.1%    1326296: 3.4%      56894
Total                                             258936448         34882576   
    191255621         39440157          5928571
source location                                     Garbage            Freed   
         Leak         Overhead            Times

Apparently largest are the gimple temporaries
after IPA:

cp/lex.c:573 (cxx_dup_lang_specific_decl)               384: 0.0%        896:
0.0%    2770736: 0.9%       2992: 0.0%      43453
cp/lex.c:510 (build_lang_decl)                       805432: 0.2%     209648:
0.2%    3196488: 1.1%     349552: 0.5%      18896
stringpool.c:74 (alloc_node)                        1994400: 0.4%          0:
0.0%    3287712: 1.1%          0: 0.0%      55022
cfg.c:142 (alloc_block)                            10005792: 2.1%          0:
0.0%    3966048: 1.4%          0: 0.0%     145540
cfg.c:280 (unchecked_make_edge)                     4507272: 0.9%    7134984:
5.8%    4456296: 1.5%    1788728: 2.5%     223591
cgraph.c:408 (cgraph_create_node)                   7802208: 1.6%          0:
0.0%    4477248: 1.5%    1364384: 1.9%      42637
cp/pt.c:8316 (tsubst_decl)                          2244888: 0.5%          0:
0.0%    4552704: 1.6%     357768: 0.5%      44721
tree.c:6061 (build_method_type_directly)            1946600: 0.4%          0:
0.0%    4703200: 1.6%     265992: 0.4%      33249
cgraph.c:638 (cgraph_create_edge)                  17196288: 3.5%          0:
0.0%    5254848: 1.8%          0: 0.0%     233866
tree-inline.c:4045 (copy_decl_to_var)                145488: 0.0%          0:
0.0%    5593392: 1.9%     273280: 0.4%      34160
gimple-iterator.c:446 (gsi_insert_after_without_   14342320: 2.9%          0:
0.0%    5650120: 1.9%    3998488: 5.7%     499811
ggc-common.c:187 (ggc_calloc)                      16950080: 3.5%    3025816:
2.4%    6151656: 2.1%     459072: 0.6%      69247
tree-ssanames.c:141 (make_ssa_name_fn)             16930080: 3.5%          0:
0.0%    8363760: 2.9%    1686256: 2.4%     210782
gimplify.c:521 (create_tmp_var_raw)                 5453784: 1.1%          0:
0.0%    9020256: 3.1%     689240: 1.0%      86155
tree.c:962 (build_int_cst_wide)                        6096: 0.0%          0:
0.0%   10131688: 3.5%    3323928: 4.7%       2299
tree-inline.c:3589 (copy_tree_r)                   49631032:10.2%          0:
0.0%   12553384: 4.3%    5797568: 8.2%     800223
tree-dfa.c:150 (create_var_ann)                           0: 0.0%  
27303320:22.0%   12672616: 4.3%    3634176: 5.1%     454272
gimple.c:2106 (gimple_copy)                        11226992: 2.3%          0:
0.0%   13146032: 4.5%    1196784: 1.7%     209491
cp/lex.c:590 (copy_decl)                              64104: 0.0%          0:
0.0%   13548720: 4.6%    1326296: 1.9%      56894
tree-inline.c:484 (remap_block)                     1928264: 0.4%          0:
0.0%   14843088: 5.1%    1290104: 1.8%     161263
tree-ssa-operands.c:499 (ssa_operand_alloc)               0: 0.0%  
34199342:27.6%   18090837: 6.2%    3566211: 5.0%      11251
tree-inline.c:4088 (copy_decl_no_change)           11756840: 2.4%          0:
0.0%   40988416:14.0%    2425144: 3.4%     317455
Total                                             487237966        123888014   
    293018044         70674672          9669114
source location                                     Garbage            Freed   
         Leak         Overhead            Times

so debug info and declarations are quite top.  This is with my DECL_INGORED_P
fix I plan to commit to mainline soon.

5MB are also bitmaps
tree-ssa-operands.c:2381 (add_to_addressa  73585    9052240    5946000   
4181320     173579

I suspect most of the rest are operand caches, since they are so ineffective
for small functions.

at end of compilation:
tree-inline.c:484 (remap_block)                    29218176: 2.1%          0:
0.0%        104: 0.0%    2247560: 1.3%     280945
cselib.c:1155 (cselib_subst_to_values)             31320504: 2.3%          0:
0.0%          0: 0.0%    5958648: 3.4%     838942
cp/call.c:2346 (add_template_candidate_real)       31457040: 2.3%          0:
0.0%          0: 0.0%    3096816: 1.8%     457682
gimple-iterator.c:446 (gsi_insert_after_without_   32515440: 2.3%          0:
0.0%          0: 0.0%    6503088: 3.7%     812886
tree-phinodes.c:157 (allocate_phi_node)            33375352: 2.4%          0:
0.0%          0: 0.0%    1120888: 0.6%     108792
ggc-common.c:187 (ggc_calloc)                      34614992: 2.5%    9072016:
2.6%    1895328: 2.0%     671680: 0.4%     102129
rtl.c:269 (copy_rtx)                               42322896: 3.1%          0:
0.0%          0: 0.0%    8318000: 4.7%    1083689
emit-rtl.c:3348 (make_insn_raw)                    42838312: 3.1%          0:
0.0%         88: 0.0%    3894400: 2.2%     486800
gimple.c:2106 (gimple_copy)                        43173352: 3.1%          0:
0.0%          0: 0.0%    2063688: 1.2%     368502
tree-ssanames.c:141 (make_ssa_name_fn)             73506000: 5.3%          0:
0.0%      26640: 0.0%    4902176: 2.8%     612772
tree-inline.c:4088 (copy_decl_no_change)           93714848: 6.8%          0:
0.0%     176464: 0.2%    4370928: 2.5%     562896
tree-inline.c:3589 (copy_tree_r)                   98165464: 7.1%          0:
0.0%       2352: 0.0%    9178696: 5.2%    1250363
Total                                            1385145407        354509964   
     93434594        175468533         23822336
source location                                     Garbage            Freed   
         Leak         Overhead            Times

positive thing is that there are no leaked gimple statements at all.  Most of
alocation at the end is:
cp/lex.c:590 (copy_decl)                            1532928: 0.1%          0:
0.0%   12079896:12.9%    1326296: 0.8%      56894
tree.c:962 (build_int_cst_wide)                        6096: 0.0%          0:
0.0%   10359544:11.1%    3388072: 1.9%       3011
tree.c:6061 (build_method_type_directly)            1947800: 0.1%          0:
0.0%    4703200: 5.0%     266040: 0.2%      33255
cp/pt.c:8316 (tsubst_decl)                          2244888: 0.2%          0:
0.0%    4552704: 4.9%     357768: 0.2%      44721

DF and PRE allocate some giant bitmaps:
df-problems.c:308 (df_rd_alloc)           145581   12612800   11870840  
11870840     597073
df-problems.c:309 (df_rd_alloc)           145581    8655600    8293080   
8293080     108099
df-problems.c:310 (df_rd_alloc)           145581   15585520   14869800  
14869800    1391724
tree-ssa-pre.c:584 (bitmap_set_new)       987262   68922080   53349440  
53349440    2631124
tree-ssa-pre.c:585 (bitmap_set_new)       987262   69386800   53918200  
53918200    3978100
df-problems.c:311 (df_rd_alloc)           145581   74605440   73361600  
73361600          0
df-problems.c:539 (df_rd_transfer_functio 100011   63125520   42433280  
42433280     148378

My guess is that ssa-operands can be easiest to track if I am right about their
memory usage.

Honza


-- 

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com
   Last reconfirmed|2007-09-20 14:09:06         |2008-09-06 14:12:03
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12850



More information about the Gcc-bugs mailing list