Man Page malloc.3f




NAME

     malloc, malloc64 - allocate memory and return the address


SYNOPSIS

     INTEGER*4 function malloc(nsize)
     INTEGER*4 nsize
             in 32-bit environments

     INTEGER*8 function malloc(nsize)
     INTEGER*4 nsize
             in 64-bit environments (SPARC only)

     INTEGER*8 function malloc64(nsize)
     INTEGER*8 nsize
             in all environments (SPARC only)


DESCRIPTION

     The 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.

     When compiled to run in a 64-bit environment,  MALLOC  takes
     an  INTEGER*4 argument and returns an INTEGER*8 value.  Oth-
     erwise, it returns a 32-bit INTEGER*4 value

     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  environ-
     ments. Be sure that variables receiving the result from MAL-
     LOC64 are declared INTEGER*8 or POINTER.


NOTES

     Compiling to run in a 64-bit environment means compiling the
     program  with  -xarch=v9|v9a and executing on a 64-bit SPARC
     V9 or UltraSPARC processor in  a  64-bit  Solaris  operating
     environment.


FILES

     /usr/lang/f77/libF77.a


SEE ALSO

     free(3F)