Volume 1 malloc, free, realloc, calloc, mallopt, mallinfo, alloca, or valloc Subroutine Purpose Provides a memory allocator. Description The malloc and free subroutines provide a general-purpose memory allocation package. The malloc subroutine returns a pointer to a block of memory of at least the number of bytes specified by the Size parameter. The block is aligned so that it can be used for any type of data.
Undefined results occur if the space assigned by the malloc subroutine is overrun.
The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc , calloc , or realloc subroutines and not been deallocated with the free or realloc subroutines.