Go to main content
Oracle Developer Studio 12.5 Man Pages

Exit Print View

Updated: June 2017
 
 

malloc64(3F)

Name

malloc, malloc64 - allocate memory and return the address

Synopsis

function malloc(nsize)
[integer] nsize
integer*8 function malloc64(nsize)
integer*8 nsize

Description

The intrinsic function malloc(nsize) allocates an area of memory, and returns the address of the start of that area. The argument to the function is an integer that specifies the amount of memory to be allocated, in bytes. If successful, it returns a pointer to the first element of the region; otherwise, it returns an integer 0.

Typically, the variable receiving the result from malloc or malloc64 is declared pointer.

The region of memory is not initialized in any way -- assume it is random bits.

malloc() is an intrinsic function and does not need an explicit type declaration. It returns integer*8 in 64-bit environments, and integer*4 in 32-bit environments. nsize can be an integer of any size.

The function malloc64 takes an integer*8 argument and always returns an integer*8 result. Use this function in programs that are intended to run in both 32-bit and 64-bit environments. Be sure that variables receiving the result from malloc64 are declared integer*8 or pointer.

Notes

Compiling to run in a 64-bit environment means compiling the program with -m64 and executing on a 64-bit processor in a 64-bit operating environment.

Files

libfsu.a

See Also

free(3F)