delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/10/10:07:45

Date: Wed, 10 Nov 1999 13:58:44 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Sebastian Buntin <sebastian AT buntin DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: problem with large arrays -> SIGSEGV Stack Fault
In-Reply-To: <001a01bf2a1b$508f10a0$641e13ac@garfield.gobi-gotha.de>
Message-ID: <Pine.SUN.3.91.991110135724.8611b-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 8 Nov 1999, Sebastian Buntin wrote:

> typedef struct {
> 
>     float x,y,z;
>     float w;
>     int faces;
>     int faceto[10];
> } vector3d;
> 
> int main () {
>     // some declarations....
>     int k;
>     vector3d obj[8000];
>     printf("HELLO\n");
> 
>     for (k=0;k<8000;k++)
>     do_some_stuff(&obj[k], var1, var2);
> 
> 
>     // rest of code (switch to graphic mode, putpixel, etc...)
> }
> 
> using this code works very well (and of course FAST)...but if I increase the
> array-size, or add MANY more variables, the program still compiles very
> well...but breaks with
> 
> SIGSEGV
> Stack Fault at eip=00001b21

You are overflowing the 512KB run-time stack ("8000*sizeof(vector3d)" is 
_way_ more than 512KB).  See section 15.9 of the DJGPP FAQ list for more 
about this.

- Raw text -


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