Description: | Allocates a block of memory. This specific function cannot be passed as an actual argument. | ||
Class: | Elemental function; Specific | ||
Arguments: | I must be of type INTEGER(4). This value is the size (in bytes) of memory to be allocated. | ||
Results: | The result type is INTEGER(4) on Windows NT and Windows 9* systems; INTEGER(8) on OpenVMS, Tru64 UNIX, and Linux systems. The result is the starting address of the allocated memory. The memory allocated can be freed by using the FREE intrinsic function (see Section 9.3.55). |
Examples
Consider the following:
INTEGER(4) ADDR, SIZE
SIZE = 1024 ! Size in bytes
ADDR = MALLOC(SIZE) ! Allocate the memory
CALL FREE(ADDR) ! Free it
END