[comp.sys.mac.programmer] MacApp & Segment Management

lsr@Apple.COM (Larry Rosenstein) (03/02/89)

In article <2642@pegasus.ATT.COM> ech@pegasus.ATT.COM (Edward C Horvath) 
writes:
> If this sounds like a royal pain in the back of your lap, you're
>absolutely right.  If you're writing a commercial application with rigid
>memory constraints you will have to do it anyway.  Or hope that MacApp does
>it right for you, but MacApp is not the Philosopher's Stone: it can only
>deal properly with what it understands.

MacApp follows the apporahc of unloading all segments everytime through 
the main event loop.  There is a call UnloadAllSegments that programmers 
can call to do this at other times.

MacApp does provide some other handy things.  First, you can mark segments 
as resident, which means they won't be unloaded by UnloadAllSegments.  
MacApp automatically does this for one of its segments, which should never 
get unloaded.  You can dynamically change the resident bit for a segment
(although you need to be careful about making a segment non-resident).

MacApp also provides a call to pre-load a segment.  This will bring it 
into memory and lock it at the top of the heap.  This may be useful is you 
need to carefully arrange how your segments are loaded.

Segments that are unloaded are not necessarily purged from memory.  They  
are simply unlocked and left in the heap.  The only penalties for 
re-loading a segment is moving it to the top of memory (possibly) and 
fixing up the jump table.

Larry Rosenstein, Apple Computer, Inc.

Internet: lsr@Apple.com   UUCP: {nsc, sun}!apple!lsr
AppleLink: Rosenstein1