9.3.92 MALLOC (I)

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 type is INTEGER(4) on Windows NT (including Windows 2000) 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) 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


Previous Page Next Page Table of Contents