When a program is terminated with the TERM macro or the CANCEL-PROGRAM or EXIT-JOB (LOGOFF) command, all of the user memory space previously occupied by DBL or the static loader ELDE is released.
The UNBIND macro can be used during the program run to release the memory space occupied by objects that are no longer required. The object may be a context, a load unit, an LLM or an object module (OM). Object modules and LLMs can be unloaded only as entities. The objects can also be specified via a path, for example:
a module in a specific context
a module in a specific load unit with a defined version
a module in a specific load unit with a defined version in a specific context
a load unit with a defined version in a specific context.
Modules which are part of a list name unit (see "Management of list name units") cannot be unloaded individually, but only with the entire list name unit.
In each case, only the first object matching the path which is found is unloaded. Occupied memory space is always released in page-sized units (1 page = 4 Kbytes). The memory space is returned to memory management only if no other modules require space on the same page. Otherwise DBL notes the free areas and uses them at the next opportunity.
In addition to unloading objects, it is also possible to unlink external references to control sections (CSECTs) and entry points (ENTRYs) in these objects (parameter UNLINK=YES).
Unlinking means that resolved external references to CSECTs and ENTRYs in the unloaded objects are released. Resolved XDSECs are an exception. The external references in the objects are then equivalent to unresolved external references at the time of linking and loading. They are given the value specified for unresolved external references in the load call (ERROR-EXIT operand) and, if this is specified in the load call, are treated as external references which are to be resolved at a later time.
Unlinking is performed only within the context in which the module is being unloaded. eferences in other contexts to the object being unloaded are not unlinked. Unlinking is performed only if the external references belong to a load unit for which an external symbol dictionary with references was loaded in the load call (operand LOAD-INFORMATION= *REFERENCES).