Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Eli Zaretskii , Herman Geza , djgpp AT delorie DOT com Date: Thu, 9 Oct 1997 13:58:03 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Compiler crashes... Precedence: bulk Eli wrote: > On Wed, 8 Oct 1997, Salvador Eduardo Tropea (SET) wrote: > > > Bad news: > > GCC doesn't support big arrays with initialization, like this: > > > > char XXX[100000]={ 1,2,.... > > ... > > ... 99999 }; > > > > The compiler will crash or if you have luck (like I have) it will > > report out of virtual memory. Seems that gcc uses MUCH more memory > > for this that what we can think. For example: 300000 elements needs > > more than 40Mb. > > Are you sure? Can you post a short program that shows this problem? I'm sure, I thinked was my fault, but Shawn got GPFs making that. I just got out of virtual .... I'll make a program to generate such a file. I saw it when converting GRX (X-windows) fonts to .o files. The best solution is to use assembler like Shawn found. > Testing with a program that I used (see below) indicates that it takes > cc1 about 10MB to compile it. But I never had any crashes or "out of > memory" messages. > > #include > #include > > unsigned xxx[100000] = { > 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, /* 9,999 lines like this */ > 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, > .... > .... > 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, > }; > > int main (void) > { > return printf ("%d\n", xxx[rand() % 3] + xxx[rand() % 4]); > } I'll give you exact numbers, but I remmember that was imposible to create .o files of 300Kb with A LOT of virtual available. And the error was ouf of virtual and not an stack fault, that's the most strange part. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013