home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!noc.near.net!news.cs.brandeis.edu!news!phils
- From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
- Subject: Re: How to increase stack size ???
- In-Reply-To: buckeye@spf.trw.com's message of Wed, 2 Sep 92 20: 23:29 GMT
- Message-ID: <PHILS.92Sep4090350@chaos.cs.brandeis.edu>
- Sender: news@news.cs.brandeis.edu (USENET News System)
- Organization: Symantec Corp.
- References: <1992Sep1.145611.1@uwovax.uwo.ca> <1992Sep2.154822.12924@novell.com>
- <2AA522C1.F27@deneva.sdd.trw.com>
- Date: Fri, 4 Sep 1992 14:03:50 GMT
- Lines: 33
-
- >>>>> On Wed, 2 Sep 92 20:23:29 GMT, buckeye@spf.trw.com (John Wallace) said:
-
- > if (StackSpace() < STACK_MIN)
- > SetApplLimit(StackPtr() - (STACK_MIN - StackSpace()))
-
- > This will make sure that you don't waste too much memory on "Large"
- > machines. (StackSpace is a standard Toolbox trap.)
-
- This is the best solution, but... On 68000 machines, the trap
- StackSpace() returns garbage unless you've already called
- MaxApplZone() (in which case the call to SetApplLimit will fail). I'm
- not sure, but this may have been fixed in System 7.
-
- In any event, I would recommend using the low memory global DefltStack
- instead. In THINK C, you can just write:
-
- SetApplLimit(GetApplLimit() - (STACK_NEEDED - DefltStack));
-
- In MPW C, you'd use:
-
- SetApplLimit(GetApplLimit() - (STACK_NEEDED - *((long *)DefltStack)));
-
- In Pascal, you'd use:
-
- SetApplLimit(GetApplLimit - (STACK_NEEDED - LongPtr(DefltStack)^));
-
- Is this in the FAQ?
-
- -phil
- --
- Phil Shapiro Software Engineer
- Language Products Group Symantec Corporation
- Internet: phils@cs.brandeis.edu
-