Important: The information in this document is obsolete and should not be used for new development.
Unloading Code SegmentsYou can use the
UnloadSegprocedure to unload segments. To unload a particular segment, pass
UnloadSegthe address of any externally referenced routine contained in that segment. For example, to unload the segment that contains the procedure
DoPrintFile, execute this line of code:
UnloadSeg(@DoPrintFile);You can call
UnloadSegat any time except when you are executing code contained in the segment to be unloaded. A typical strategy is to unload all code segments except segment 1 and any other essential code segments each time through your application's main event loop.
- Before you unload a segment, make sure that your application no longer needs it. Never unload a segment that contains a completion routine or other interrupt task (such as a Time Manager task or VBL task) that might be executed after the segment is unloaded. Never unload a segment that contains routines in the current call chain. ·
UnloadSegprocedure does not actually remove the segment from memory. Instead, it unlocks the segment, thereby making the segment relocatable and purgeable. This permits the Memory Manager to relocate or purge the segment if necessary to gain some space in the application heap.