home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14997 < prev    next >
Encoding:
Text File  |  1992-09-04  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!noc.near.net!news.cs.brandeis.edu!news!phils
  3. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  4. Subject: Re: How to increase stack size ???
  5. In-Reply-To: buckeye@spf.trw.com's message of Wed, 2 Sep 92 20: 23:29 GMT
  6. Message-ID: <PHILS.92Sep4090350@chaos.cs.brandeis.edu>
  7. Sender: news@news.cs.brandeis.edu (USENET News System)
  8. Organization: Symantec Corp.
  9. References: <1992Sep1.145611.1@uwovax.uwo.ca> <1992Sep2.154822.12924@novell.com>
  10.     <2AA522C1.F27@deneva.sdd.trw.com>
  11. Date: Fri, 4 Sep 1992 14:03:50 GMT
  12. Lines: 33
  13.  
  14. >>>>> On Wed, 2 Sep 92 20:23:29 GMT, buckeye@spf.trw.com (John Wallace) said:
  15.  
  16.  > if (StackSpace() < STACK_MIN)
  17.  >     SetApplLimit(StackPtr() - (STACK_MIN - StackSpace()))
  18.  
  19.  > This will make sure that you don't waste too much memory on "Large"
  20.  > machines.  (StackSpace is a standard Toolbox trap.)
  21.  
  22. This is the best solution, but... On 68000 machines, the trap
  23. StackSpace() returns garbage unless you've already called
  24. MaxApplZone() (in which case the call to SetApplLimit will fail). I'm
  25. not sure, but this may have been fixed in System 7.
  26.  
  27. In any event, I would recommend using the low memory global DefltStack
  28. instead. In THINK C, you can just write:
  29.  
  30.     SetApplLimit(GetApplLimit() - (STACK_NEEDED - DefltStack));
  31.  
  32. In MPW C, you'd use:
  33.  
  34.     SetApplLimit(GetApplLimit() - (STACK_NEEDED - *((long *)DefltStack)));
  35.  
  36. In Pascal, you'd use:
  37.  
  38.     SetApplLimit(GetApplLimit - (STACK_NEEDED - LongPtr(DefltStack)^));
  39.  
  40. Is this in the FAQ?
  41.  
  42.     -phil
  43. --
  44.    Phil Shapiro                                   Software Engineer
  45.    Language Products Group                     Symantec Corporation
  46.            Internet: phils@cs.brandeis.edu
  47.