Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!reed!lclark!dan From: dan@lclark.UUCP (Dan Revel) Newsgroups: comp.sys.mac.programmer Subject: SetApplLimit (how big a stack do I need?) Keywords: stack SetApplLimit Message-ID: <1038@lclark.UUCP> Date: 3 Jan 91 23:28:00 GMT Reply-To: dan@lclark.UUCP (Dan Revel) Organization: Lewis & Clark College, Portland OR Lines: 42 I'm using SetApplLimit to set the stack size in my program as follows: #define STACKSIZE 8192L Ptr GetSP() { register Ptr localSP; asm { movea.l sp,localSP }; return(localSP); } InitMemory() { Ptr localSP; localSP = GetSP(); SetApplLimit(localSP - STACKSIZE); MaxApplZone(); /* ... etc. ... */ } I'm pretty sure that this is the 'right' way to do it (I saw it on comp.sys.mac.programmer :-)), but my application still gets a system error 28 every now and then. (system error 28 = dsStknHeap stack has moved into application heap) So my question is: aside from trial and error how can I judge how large a stack my application will need? My guess was that 8K was more than for any possible case... wrong! So tell me does the operating system or the toolbox or Think C 4.0 have an appetite for stack space I don't know about or what?! Thanks in advance, Dan -- dan@lclark.bitnet SM 0 A9F4 tektronix!reed!lclark!dan G 0