home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pmafire!news.dell.com!swrinde!sdd.hp.com!usc!venice!gumby.dsd.trw.com!deneva!buckeye
- From: buckeye@spf.trw.com (John Wallace)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: How to increase stack size ???
- Message-ID: <2AA522C1.F27@deneva.sdd.trw.com>
- Date: 2 Sep 92 20:23:29 GMT
- References: <1992Sep1.145611.1@uwovax.uwo.ca> <1992Sep2.154822.12924@novell.com>
- Sender: news@deneva.sdd.trw.com
- Organization: TRW Sensor Data Processing Center, Redondo Beach, CA
- Lines: 41
-
- In article <1992Sep2.154822.12924@novell.com> damurphy@wc.novell.com (Duane A Murphy) writes:
- >In article <1992Sep1.145611.1@uwovax.uwo.ca> tschneid@uwovax.uwo.ca writes:
- >>
- >>I keep running out of stack space.
- >>Todd Schneider
- >
- >I also ran into a stack limitation problem. Actually the stack is handled
- >differently on different machines. It is not consistent. "Small" machines
- >have an 8K stack. "Large" machines have a 24K stack.
- >
- >#define STACK_MIN 0x8000L
- >pascal Ptr StackPtr(void) = {0x2e8f}; /* MOVE A7, (A7) */
- >
- >int main(void)
- >{
- > SetApplLimit(StackPtr() - STACK_MIN);
- >...
- >
- >
- >Hope this helps,
- >...Duane Murphy
- >Novell, Walnut Creek
- >
-
- You may want to change this to:
-
- 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.) Also, some
- development envrionments automatically call SetApplLimit as part of
- the normal application startup. For example, THINK Pascal calls
- SetApplLimit to allocate the amount of stack space you specified under
- your Run Options. Check your development environment documentation to
- see if it provides this kind of support.
-
- Cheers!
- John
- ---------------------------------------------------------------------
- John Wallace buckeye@spf.trw.com
-