[Bug preprocessor/17798] [3.4/4.0 Regression] high cpp memory usage with undefined symbols

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Dec 14 05:53:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-14 05:53 -------
The first thing is that read_file_guts mallocs the whole file which seems wrong.  That accounts for 
500M.
The next problem is that keep every identifier we parsed even though we don't need it.
3014 calls for 12,273,008 bytes: thread_a000a1ec |0x0 | _dyld_start | _start | main | toplev_main | 
do_compile | compile_file | c_common_parse_file | c_parse_file | yyparse | yylex | _yylex | c_lex | 
c_lex_with_flags | cpp_get_token | _cpp_lex_token | _cpp_handle_directive | do_ifdef | lex_macro_node 
| _cpp_lex_token | _cpp_lex_direct | lex_identifier | ht_lookup_with_hash | _obstack_newchunk | 
xmalloc | malloc | malloc_zone_malloc 

And this is where the problem comes from.
No there is no leak we keep a reference to all of thes identifiers but this seems like we should not.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4/4.0 Regression] cpp    |[3.4/4.0 Regression] high
                   |memory leak with undefined  |cpp memory usage with
                   |symbols                     |undefined symbols


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



More information about the Gcc-bugs mailing list