Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!sys.uea!jrk From: jrk@sys.uea.ac.uk (Richard Kennaway) Newsgroups: comp.sys.mac.programmer Subject: How do you expand the stack? Message-ID: <1311@sys.uea.ac.uk> Date: 21 Feb 90 13:00:26 GMT Reply-To: jrk@uea-sys.UUCP (Richard Kennaway) Organization: University of East Anglia, Norwich Lines: 32 How do you change the stack size of a Mac application? The default is only 8k, and I have a program that needs much more. I havent found any explicit description in IM or the TNs; all I can find is the description in the Memory Manager chapter of IM vol2 of GetApplLimit and SetApplLimit. From that it appears that this should do it: void GetMoreStack( extraStack ) long extraStack; /* long = 32 bits */ { Ptr heapLimit; heapLimit = GetApplLimit(); if (extraStack > 0) SetApplLimit( heapLimit - extraStack ); } This is the very first thing the application does. Is this the right way? If not, what is? I am having the problem that the program intermittently crashes when starting up, which suggests some bad memory access. It didnt happen before I added the call to the above routine. I've made other changes as well, so it may be something else, but I'd like to at least get confirmation that this part is ok. When it does run, it seems to get the extra stack space (i.e. it no longer gets the stack-has-collided- with-heap bomb). MPW C version 3, System 6.0.4, MultiFinder 6.1b7, a zillion inits, but they all work with everything else. -- Richard Kennaway SYS, University of East Anglia, Norwich, U.K. Internet: jrk@sys.uea.ac.uk uucp: ...mcvax!ukc!uea-sys!jrk