Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!purdue!haven!umbc3!wicks From: wicks@umbc3.UMBC.EDU (Mr. Tony Wicks ) Newsgroups: comp.sys.amiga Subject: Re: Lattice 5.02 bugs? Summary: Big locally declared arrays need big stacks Message-ID: <1918@umbc3.UMBC.EDU> Date: 16 Apr 89 18:41:58 GMT References: <493@bilver.UUCP> <98255@sun.Eng.Sun.COM> <505@bilver.UUCP> Reply-To: wicks@umbc3.umbc.edu.UMBC.EDU (Mr. Tony Wicks (MMA)) Distribution: na Organization: University of Maryland, Baltimore County Lines: 19 In article <505@bilver.UUCP> alj@bilver.UUCP (arthur johnson) writes: > > I set my stack to 150,000. I have a procedure which declares two 128 x 128 >integer arrays (i.e., heap o' memory), and the program would exit with a >"Stack OverFlow" recoverable error unless my stack was that high. With a >stack of 150,000, the program would run. > I'm confused - are you saying that my stack size is TOO large for the program >to run properly? Here's the deal. 128*128*4 bytes is 65536 bytes. You have two of these, using exactly 128K of memory. This wouldn't be a problem, except that you have the arrays declared local to a subroutine/procedure. When the procedure is called all of the local variables are placed on the stack (including your arrays). To avoid this you have to declare your arrays globally, and pass pointers to them. If you are using pascal or modula2 this means use a VAR parameter, in C arrays are automatically passed as pointers. Tony Wicks