delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/09/12:53:11

Message-Id: <m0xJG5k-000S1sC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
Organization: INTI
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, Herman Geza <hg211 AT hszk DOT bme DOT hu>,
djgpp AT delorie DOT com
Date: Thu, 9 Oct 1997 13:58:03 +0000
MIME-Version: 1.0
Subject: Re: Compiler crashes...

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 <stdio.h>
> #include <stdlib.h>
> 
> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019