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. This value is the size (in bytes) of memory to
be allocated.
On OpenVMS systems, if the argument is INTEGER(8), a 64-bit (P3) space is allocated. | ||
Results: | The result is of type integer(4) on ia32 processors; INTEGER(8) on Alpha and ia64 processors. 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) SIZE
REAL(4) STORAGE(*)
POINTER (ADDR, STORAGE) ! ADDR will point to STORAGE
SIZE = 1024 ! Size in bytes
ADDR = MALLOC(SIZE) ! Allocate the memory
CALL FREE(ADDR) ! Free it
END