Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!henry!hairston From: hairston@henry.ece.cmu.edu (David Hairston) Newsgroups: comp.sys.mac.programmer Subject: Re: SetApplLimit (how big a stack do I need?) Message-ID: Date: 9 Jan 91 01:02:01 GMT References: <1038@lclark.UUCP> Organization: Gaia II Lines: 45 In-reply-to: dan@lclark.UUCP's message of 3 Jan 91 23:28:00 GMT [dan@lclark.UUCP (Dan Revel) writes:] [] 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. is this equivalent to: SetAppLimit(ApplLimit - STACKSIZE); MaxApplZone(); ... where ApplLimit is the global assumed to be equal to the result returned by GetApplLimit() ? (Ref. IM, Vol II, Memory Manager) The above code fragment clearly adds 8k to the stack space (okay, i need to brush up on assembly since i don't read it well, yet. even the simple stuff like movea.l sp, localSP gives me hives). -dave- hairston@henry.ece.cmu.edu