www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/11/08:03:34

Date: Sun, 11 Feb 1996 14:53:22 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "James T. Sweeten Jr." <sweeten AT belgarath DOT nwscc DOT sea06 DOT navy DOT mil>
Cc: djgpp listserv <djgpp AT delorie DOT com>
Subject: Re: grx 2.0 problem.

On Fri, 9 Feb 1996, James T. Sweeten Jr. wrote:

> The error I get when I try to run this is:
> 
> 
> Exiting due to signal SIGSEGV
> Stack Fault at eip=00001545
> eax=00000000 ebx=0005f070 ecx=0006404c edx=00000033 esi=00000054 edi=0001e430
> ebp=0005e408 esp=fff5e408 cs=00e7 ds=00ef es=00ef fs=00cf gs=00ff ss=00ef
> Call frame traceback EIPs:
>   0x00001545
> 
> 
> I don't get errors if I reduce the array size to below 256x256.  The makefile
> I used is:

DJGPP v2.0 limits the stack at 256KB by default.  512x512 gives 256KB,
which is more than what you have after some of the stack was taken by the
startup code.  You can enlarge the default stack by using STUBEDIT or by
setting _stklen global variable.  Here is the relevant portion of the
DJGPP FAQ list (for v1.x, since v2.0 FAQ doesn't exist yet): 

15.7  Q: My program bombs when I use very large automatic arrays.
      Q: How much stack space do I have in my program?
      A: Under VCPI your stack will dynamically expand as required, so you
         have virtually unlimited stack.  Unfortunately, this can't be
         done under DPMI, so there you get a fixed-size stack which
         defaults to 256K.  If that's not enough, you can change it with
         STUBEDIT program (change the parameter "Minimum amount of stack
         space"), or by setting the global variable _stklen in your
         program.  Example:

                      extern unsigned _stklen = 1048576;

         Setting _stklen makes sure your program always works, but wastes
         memory, since the 256K stack originally allocated must be
         discarded.  The best bet is to do both--setting _stklen in your
         program will ensure it works, but also using STUBEDIT to set a
         slightly (by a few KB) larger amount than the value of _stklen,
         will ensure the original stack won't have to be reallocated, and
         you will save the wasted memory.

- Raw text -


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