Unloading Programs from Memory

The ACUCOBOL-GT runtime allows you to cancel and unload programs from memory based on the state of the object module. By default, the CANCEL statements and corresponding C functions, acu_cancel() and acu_cancel_all(), perform a physical cancel, placing programs in their initial state. The runtime also allows you to enable logical cancels, which may improve performance. For a description of runtime memory management and physical and logical cancels, see Memory Management.

Both logical and physical cancels close open files and ensure that any VALUE clauses are in effect when the program is called again. Physical cancels also release any memory used by the program

The following C functions unload one or all programs from memory based on the state of the object module:

The acu_cancel() and acu_cancel_all() functions perform a logical cancel. The acu_unload() and acu_unload_all() functions perform a physical cancel and force a subsequent call to load the new object file from disk.

Using these functions, an object module can be in one of four states:

Note that the LOGICAL_CANCELS and DYNAMIC_MEMORY_LIMIT configuration variables affect how canceled programs are handled. For information on these variables, see Configuration Variables.