M$FREE (Dynamic Memory Routine)

Frees a previously allocated piece of memory.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

Usage

CALL "M$FREE" 
    USING MEM-ADDRESS

Parameter

MEM-ADDRESS USAGE POINTER Must point to a memory area previously allocated by M$ALLOC.

Comments

Use M$FREE to release a memory block allocated by M$ALLOC. This memory is returned to the pool of memory available for use by the run-time system. On most operating systems, this memory is still associated with the run-time system's process, so it cannot be used by any other processes. On a few systems, this memory may be made available to the operating system for re-use by other processes.

It is an error to attempt to use a block of memory once it has been freed. It is also an error to free a block of memory more than once or to free a memory address that has never been allocated. Any of these errors can lead to memory access violations. The run-time system attempts to detect these errors and avoid them, but it cannot detect all such errors.

Compatibility Issues

None.