public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/17798] New: cpp memory leak with undefined symbols
@ 2004-10-02 22:24 rth at gcc dot gnu dot org
  2004-10-02 22:38 ` [Bug preprocessor/17798] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-10-02 22:24 UTC (permalink / raw)
  To: gcc-bugs

The following generator program

#include <stdio.h>
#include <stdlib.h>                                                            
                   
int main()
{
  int i;
  setvbuf (stdout, malloc(32768), _IOFBF, 32768);                              
                                               
  for (i = 0; i < 10000000; ++i)
    printf ("#ifdef M%d\nchar c%d[] = M%d;\n#endif\n", i, i, i);               
                                                               
  return 0;
}

builds a 483MB file which contains nothing but #ifdefs against undefined
symbols.  The preprocessed file should contain nothing but cpp line notes.

With gcc 3.2, cpp0 has peak memory usage of 930MB.
With gcc 3.4 and 4.0, cc1 has peak memory usage of 2010MB.

While this does strike me as a bit silly, apparently there are users trying
this sort of thing.

  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=68634

-- 
           Summary: cpp memory leak with undefined symbols
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Keywords: memory-hog
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-02-09  8:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-02 22:24 [Bug preprocessor/17798] New: cpp memory leak with undefined symbols rth at gcc dot gnu dot org
2004-10-02 22:38 ` [Bug preprocessor/17798] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-03 17:56 ` pinskia at gcc dot gnu dot org
2004-10-07  0:33 ` stuartm at connecttech dot com
2004-10-07  0:39 ` pinskia at gcc dot gnu dot org
2004-11-01  0:45 ` mmitchel at gcc dot gnu dot org
2004-12-14  5:28 ` pinskia at gcc dot gnu dot org
2004-12-14  5:53 ` [Bug preprocessor/17798] [3.4/4.0 Regression] high cpp memory usage " pinskia at gcc dot gnu dot org
2004-12-14 13:56   ` Neil Booth
2004-12-14 13:57 ` neil at daikokuya dot co dot uk
2005-02-09 14:05 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).