Mail Archives: djgpp/1998/04/01/21:01:06
At 07:50  3/31/1998 GMT, Aquinas wrote:
>Okay, I'm new to this C/DJGPP/Programming stuff so bear with me....
>
>Can someone direct me to a good explanation of memory allocation limits, and 
>how to allocate large amounts of memory in DJGPP (presumably this involves 
>DPMI servers and such).  What I'm wondering right now is....
>
>The following program crashes due to a stack dump of some sort (I'm somewhat 
>shaky on what this means)...
You're confusing the cause and the effect. *When* the program crashes (by
doing something illegal), a register dump and stack traceback is printed to
help you debug it. The `symify' program can help make those numbers more
meaningful.
>
>int main() {
>
>double x[10000][100];
[deletia]
>Obviously all this program does is try to crash my making too big an array.  
>It worked okay when modified to:
>
>int main() {
>
>double x[10][100];
[expunged]
>So in a DPMI/Protected mode environment like DJGPP, why can't you have a 
>big-ass array like int x[1000000]?  Is there a good explanation of this 
>somewhere?  Any help would be much appreciated.  
You can, just not when it's auto. DPMI has some limitations that prevent the
implementation of a dynamically expanding stack. Therefore, it's set to a
fixed size on startup. FAQ section 16.9 explains the ways in which you can
increase this. A simpler fix is to declare the array `static', or to make it
global.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -