home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 15002 < prev    next >
Encoding:
Internet Message Format  |  1992-09-04  |  1.9 KB

  1. Path: sparky!uunet!crdgw1!newsun!damurphy
  2. From: damurphy@wc.novell.com (Duane A Murphy)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: How to increase stack size ???
  5. Message-ID: <1992Sep4.160059.29329@novell.com>
  6. Date: 4 Sep 92 16:00:59 GMT
  7. References: <1992Sep2.154822.12924@novell.com> <2AA522C1.F27@deneva.sdd.trw.com> <PHILS.92Sep4090350@chaos.cs.brandeis.edu>
  8. Sender: news@novell.com (The Netnews Manager)
  9. Organization: Novell, Inc. - Walnut Creek
  10. Lines: 33
  11. Nntp-Posting-Host: optics
  12.  
  13. In article <PHILS.92Sep4090350@chaos.cs.brandeis.edu> phils@chaos.cs.brandeis.edu (Phil Shapiro) writes:
  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.  
  33. Thank you for jogging my memory.  This is the problem that I ran into.
  34. Once MaxApplZone is called adjusting the stack space larger will
  35. cross into the heap space simulating a stack heap collision.  That is
  36. why it was necassary to adjust the stack size at the start as opposed
  37. to dynamically at run time. (I think this sounds rights).
  38.  
  39. How can one adjust the stack size dynamically (as recommended by DTS)
  40. when it simulates moving the stack into the heap?
  41.  
  42. No it is not fixed on System 7.  In fact StackSpace() works differently on
  43. different models with the _SAME_ system!  This was very confusing.
  44.  
  45. ...Duane
  46.