home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14950 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  1.8 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: <1992Sep3.180837.8540@novell.com>
  6. Date: 3 Sep 92 18:08:37 GMT
  7. References: <1992Sep1.145611.1@uwovax.uwo.ca> <1992Sep2.154822.12924@novell.com> <71922@apple.Apple.COM>
  8. Sender: usenet@novell.com (The Netnews Manager)
  9. Organization: Novell, Inc. - Walnut Creek
  10. Lines: 35
  11. Nntp-Posting-Host: optics
  12.  
  13. In article <71922@apple.Apple.COM> grobbins@Apple.COM (Grobbins) writes:
  14. >
  15. >  // Increase the space allocated for the application stack
  16. >  //
  17. >  // Warning: SetApplLimit always sets the stack to at least as large as the 
  18. >  //    default stack for the machine (8K on machines with original QuickDraw,  
  19. >  //    24K on machines with Color QuickDraw) so the application partition 
  20. >  //    must be large enough to accomodate an appropriate stack and heap
  21. >
  22. >  OSErr IncreaseApplicationStack(Size incrementSize)
  23. >  {
  24. >    OSErr retCode;
  25. >  
  26. >    // increase the stack size by lowering the heap limit
  27. >    SetApplLimit((Ptr) ((unsigned long) GetApplLimit() - incrementSize));
  28. >    retCode = MemError();
  29. >    if (retCode == noErr) MaxApplZone();
  30. >  
  31. >    return retCode;
  32. >  }
  33. >
  34. >Do heed the warning given in the comment.  All stack allocation beyond
  35. >the default must be compensated for by increasing the partition size in
  36. >the SIZE -1 resource.  
  37. >
  38.  
  39. Be forwarned to test this on many machines (namely an SE or other 68000
  40. based machine).  I believe I tried this; it may have even been one of 
  41. my first attempts.  I think this works but is it what is desired?
  42.  
  43. This increases the stack size by an amount.  It does not _SET_ the stack
  44. size.  I needed (as I believe the original author did) to set the 
  45. stack size to a particular size.
  46.  
  47. ...Duane
  48.