This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/17798] New: cpp memory leak with undefined symbols
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2004 22:24:01 -0000
- Subject: [Bug preprocessor/17798] New: cpp memory leak with undefined symbols
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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