www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/03/04:09:44

Date: Sun, 3 Jan 1999 11:07:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Roger Lindström <kjell DOT lindstrom AT sundsvall DOT mail DOT telia DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: program crash
In-Reply-To: <368e3f41.0@d2o30.telia.com>
Message-ID: <Pine.SUN.3.91.990103110649.12860N-100000@is>
MIME-Version: 1.0
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id EAA25024
Reply-To: djgpp AT delorie DOT com

On Sat, 2 Jan 1999, Roger Lindström wrote:

> Help!! My program crashes if antal ( look at row **** This one ****) is over
> 12000. Can someone tell me wahts wrong.
[...]
> #define antal 1000 // **** This one ****
>         Star lista[antal];

This is in the FAQ (section 15.9).

You are defining a local array.  Memory for such ararys is allocated
off the stack.  DJGPP programs have by default a 256KB stack.
However, in your case, "sizeof(Star)" is something like 40 bytes, so
12000 of Star objects sum up to 480000 bytes, and that blows up the
default stack.

See section 15.9 of the FAQ for solutions.

- Raw text -


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