StrongForth.f Memory-Allocation Glossary


ALLOCATE ( UNSIGNED -- ADDRESS SIGNED )

Allocate UNSIGNED address units of contiguous memory space. The initial content of the allocated memory space is undefined. If the allocation succeeds, ADDRESS is the aligned starting address of the allocated memory space and SIGNED is zero. If the operation fails, ADDRESS does not represent a valid address and SIGNED is the I/O result code.


CALLOCATE ( UNSIGNED -- CADDRESS SIGNED )

Allocate UNSIGNED address units of contiguous memory space. The initial content of the allocated memory space is undefined. If the allocation succeeds, CADDRESS is the aligned starting address of the allocated memory space and SIGNED is zero. If the operation fails, CADDRESS does not represent a valid address and SIGNED is the I/O result code.


FREE ( ADDRESS -- SIGNED )

Return the contiguous memory space starting at ADDRESS to the system for later allocation. ADDRESS shall indicate a memory space that was previously obtained by ALLOCATE, CALLOCATE or RESIZE. If the operation succeeds, or ADDRESS is null, SIGNED is zero. If the operation fails, SIGNED is the I/O result code.


RESIZE ( ADDRESS UNSIGNED -- 1ST SIGNED )

Change the allocation of the contiguous memory space starting at the address ADDRESS, previously allocated by ALLOCATE, CALLOCATE or RESIZE, to UNSIGNED address units. UNSIGNED may be either larger or smaller than the current size of the memory space. If the operation succeeds, 1ST is the aligned starting address of UNSIGNED address units of allocated memory and SIGNED is zero. 1ST may be, but need not be, the same as ADDRESS. If they are not the same, the values contained in the memory space at ADDRESS are copied to 1ST, up to the minimum size of either of the two memory spaces. If they are the same, the values contained in the memory space are preserved. If 1ST is not the same as ADDRESS, the memory space at ADDRESS is returned to the system according to the operation of FREE.

If the operation fails, 1ST equals ADDRESS, the memory space at ADDRESS is unaffected, and SIGNED is the I/O result code.


Dr. Stephan Becher - January 30th, 2009