A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-E8D902BA-9BFC-48B2-A846-E96035DB6ECF
Visible to Intel only — GUID: GUID-E8D902BA-9BFC-48B2-A846-E96035DB6ECF
MALLOC
Elemental Intrinsic Function (Generic): Allocates a block of memory. This is a generic function that has no specific function associated with it. It must not be passed as an actual argument.
result = MALLOC (size)
size |
(Input) Must be of type integer. This value is the size (in bytes) of memory to be allocated. |
Results
The result type is INTEGER(8). The result is the starting address of the allocated memory. The memory allocated can be freed by using the FREE intrinsic function.
Example
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