Important: The information in this document is obsolete and should not be used for new development.
Unloading Code Segments
You can use theUnloadSeg
procedure to unload segments. To unload a particular segment, passUnloadSeg
the address of any externally referenced routine contained in that segment. For example, to unload the segment that contains the procedureDoPrintFile
, execute this line of code:
UnloadSeg(@DoPrintFile);You can callUnloadSeg
at 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.
The
- WARNING
- 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. ·
UnloadSeg
procedure 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.