home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14056 < prev    next >
Encoding:
Text File  |  1992-08-15  |  1.8 KB  |  39 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!sun4nl!utrcu1!infnews!heksterb
  3. From: heksterb@cs.utwente.nl (Ben Hekster)
  4. Subject: Re: Porting code using fork() to the Mac
  5. Message-ID: <1992Aug16.083656.22198@cs.utwente.nl>
  6. Sender: usenet@cs.utwente.nl
  7. Nntp-Posting-Host: utis96
  8. Organization: University of Twente, Dept. of Computer Science
  9. References: <503@owl.ukc.ac.uk> <1992Aug14.181503.3108@amgen.com> <1992Aug16.001018.26666@reed.edu>
  10. Date: Sun, 16 Aug 1992 08:36:56 GMT
  11. Lines: 26
  12.  
  13. In article <1992Aug16.001018.26666@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  14. >  In the docs, there is some interesting discussion of a scheme for marking
  15. >all unused code resources purgeable. The idea was to mark all code
  16. >resources purgeable with the obvious exception of one resource, followed by
  17. >a walk of the stack looking for anything resembling a return address, so
  18. >that the relevant resources could be marked as non-purgeable.
  19.  
  20. Hey, I do this!  And you say this scheme is actually documented
  21. somewhere?  It's exactly as you describe-- I keep all but a few 'CODE'
  22. segments purgeable, and install a grow zone function that scans the
  23. stack for addresses within these segments.  Any segment that
  24. isn't referenced from the stack is unloaded from the gz function.
  25. I know it sounds skanky but it works great!
  26.  
  27.     Obvious advantages:  I never ever have to worry about calling
  28. UnloadSeg again, so I can resegment my applications at any time without
  29. having to worry about whether I'm doing UnloadSeg calls in the right
  30. order and in the right place, and since I'm also not doing UnloadSeg
  31. in the main event loop on every CODE segment, there is zero overhead,
  32. if you have enough memory.
  33.  
  34.     Disadvantage:  Could fail under Pink.
  35.  
  36. -- 
  37. Ben `Hackster' Hekster        | "He bides his time and thinks,
  38. heksterb@cs.utwente.nl        |  'There must be more to life than this!'"
  39.