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

  1. Path: sparky!uunet!pmafire!news.dell.com!swrinde!sdd.hp.com!usc!venice!gumby.dsd.trw.com!deneva!buckeye
  2. From: buckeye@spf.trw.com (John Wallace)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: How to increase stack size ???
  5. Message-ID: <2AA522C1.F27@deneva.sdd.trw.com>
  6. Date: 2 Sep 92 20:23:29 GMT
  7. References: <1992Sep1.145611.1@uwovax.uwo.ca> <1992Sep2.154822.12924@novell.com>
  8. Sender: news@deneva.sdd.trw.com
  9. Organization: TRW Sensor Data Processing Center, Redondo Beach, CA
  10. Lines: 41
  11.  
  12. In article <1992Sep2.154822.12924@novell.com> damurphy@wc.novell.com (Duane A Murphy) writes:
  13. >In article <1992Sep1.145611.1@uwovax.uwo.ca> tschneid@uwovax.uwo.ca writes:
  14. >>
  15. >>I keep running out of stack space. 
  16. >>Todd Schneider
  17. >
  18. >I also ran into a stack limitation problem.  Actually the stack is handled 
  19. >differently on different machines.  It is not consistent.  "Small" machines
  20. >have an 8K stack.  "Large" machines have a 24K stack.  
  21. >
  22. >#define STACK_MIN 0x8000L
  23. >pascal Ptr StackPtr(void) = {0x2e8f};    /* MOVE A7, (A7) */
  24. >
  25. >int main(void)
  26. >{
  27. >    SetApplLimit(StackPtr() - STACK_MIN);
  28. >...
  29. >
  30. >
  31. >Hope this helps,
  32. >...Duane Murphy
  33. >Novell, Walnut Creek
  34. >
  35.  
  36. You may want to change this to:
  37.  
  38. if (StackSpace() < STACK_MIN)
  39.     SetApplLimit(StackPtr() - (STACK_MIN - StackSpace()))
  40.  
  41. This will make sure that you don't waste too much memory on "Large"
  42. machines.  (StackSpace is a standard Toolbox trap.)  Also, some 
  43. development envrionments automatically call SetApplLimit as part of 
  44. the normal application startup.  For example, THINK Pascal calls 
  45. SetApplLimit to allocate the amount of stack space you specified under 
  46. your Run Options.  Check your development environment documentation to 
  47. see if it provides this kind of support.
  48.  
  49. Cheers!
  50. John
  51. ---------------------------------------------------------------------
  52. John Wallace                     buckeye@spf.trw.com
  53.