malloc()

NAME

malloc() - general memory allocation function

SYNOPSIS

#include <stdlib.h>

void * malloc (size_t size)

DESCRIPTION

The malloc(3) function allocates uninitialized space for an object whose size is specified by size. The malloc(3) function maintains multiple lists of free blocks according to size, allocating space from the appropriate list.

On INTERIX, each call to malloc(0) returns a different value.

RETURN VALUES

Upon successful completion with size not equal to 0, malloc() returns a pointer to the allocated space. If size is 0, either a null pointer or a unique pointer that can be successfully passed to free(3) will be returned. Otherwise, it returns a null pointer and sets errno to indicate the error.

ERRORS

The malloc() function will fail if:

[ENOMEM]
Insufficient storage space is available.

SEE ALSO

calloc(3)

free(3)

realloc(3)