Mail Archives: djgpp/1999/01/03/04:09:44
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 -