MSC STACK OVERFLOW

alan denney aland at infmx.UUCP
Wed Mar 16 20:31:48 AEST 1988


In article <12416 at brl-adm.ARPA>, SWANGER%AUDUCVAX.BITNET at CUNYVM.CUNY.EDU writes:
> 
> I am using MSC 5.0 to write a software package for my IBM PC clone.  I am
> having problems with stack overflow.  I've tried enlarging the stack with
> the /ST flag, but I'm approaching the 64k stack limit.  My code is only
> about 500 lines or so, but when I get about three functions deep, the
> program dies with a stack overflow message.  I'm using the large memory
> model, all of my arrays are dynamically allocated with calloc, I'm using
> a lot of integer variables (but not that many), and I'm using a lot of
> functions from the screen formatting package Vitamin C.  Does anyone have
> any suggestions how I can get around this problem?  Is there a way to
> increase the stack size past 64k, or is this an Intel curse?  Is any data
> being put on the stack that could be put on the heap?
> 
> I would appreciate any help anyone could give me.
> 

This info assumes that you are getting "Error 6000: Stack Overflow" at
run time.  

I hope this is helpful.  I ran into the equivalent error in MSC 4.0 (there
it's called Error 2000; nice to see that the errors are somewhat backward
compatible :-) )

This error has nothing to do (directly) with amount of code, but *data*.
This usually means that the default segment (DGROUP) cannot accomodate
all of its *initialized* data items *plus* the stack size (limit for any
segment is 64K).  Therefore, you have to either reduce stack size (not
always feasible, or even wise) or move some data out of DGROUP.  The first
thing to try is to force some data out into another segment via the /Gt 
(Data Threshold) compile flag.  For example, if you specify "/Gt512", any
data item > 512 bytes will be relocated to another segment.  (If you 
don't specify a number, 256 is assumed.  If you omit the flag entirely,
the value 32K is used, effectively forcing everything into DGROUP).
For more info, see Section 6.6 of the MSC 5.0 user guide.

> 
> ------------------------- JCL - The Big Lie ----------------------------------
> Academic Computing Services
> 200 L Building
> Auburn University, AL  36849
> Telephone: 205-826-4813              |-------------------------------------|
 
Actually, I kinda miss MVS JCL - shell scripts aren't quite as dangerous!

-- 
 Alan S. Denney                | {pyramid|uunet}!infmx!aland
 Informix Software, Inc.       | CAUTION: This terminal makes wide right turns!

 Disclaimer: These opinions are mine alone.  If I am caught or killed,
             the secretary will disavow any knowledge of my actions.

-- 
- 



More information about the Comp.lang.c mailing list