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