delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/06/20:45:34

From: a DOT gillett AT virgin DOT net (Andrew R. Gillett)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How big can I make my array?
Date: Sun, 7 Jun 1998 01:32:12 +0100
Organization: Virgin Net News Service
Lines: 29
Message-ID: <MPG.fe3efebb95c6032989725@news.virgin.net>
References: <MPG DOT fe223cb1cc75732989717 AT news DOT virgin DOT net> <3578C43D DOT F4DDB90 AT cs DOT com>
NNTP-Posting-Host: 194.168.60.138
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In comp.os.msdos.djgpp, article <3578C43D DOT F4DDB90 AT cs DOT com>, John M. 
Aldrich (fighteer AT cs DOT com) wrote:
> Andrew R. Gillett wrote:
> > 
> >     struct pixel_struct pixel[AREA_WIDTH][AREA_HEIGHT];
> > AREA_WIDTH = 640, AREA_HEIGHT = 480. I also get this error with 256x200,
> > the lowest mode Allegro can do.
> 
> Your problem is stack overflow.  If you declare a local object of that
> class, you're allocating all of the memory for the array from the
> stack.  Since the default runtime stack for DJGPP programs is 256K,
> you're overflowing it and your program will therefore crash most
> spectacularly.

This structure is 1200K...

> There are two solutions:  you can read chapter 15.9 of the DJGPP FAQ to
> learn how to increase the stack size of your programs, or you can take
> the better route and create your object statically or dynamically.

OK, sorry to keep asking questions like this, but:

How do I do that?

Do I have to use malloc or something to give myself a big chunk of 
memory? Or is it something else? The trouble is, I consider myself to be 
reasonably good at programming, but I don't have all that essential 
technical knowledge. Just the stuff they taught me at college, which is 
just the basics and nothing else...

- Raw text -


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