MALLOC(3)MALLOC(3)

NAME
malloc - memory allocation

SYNOPSIS
#include <stdlib.h>

void *
malloc(size_t size);

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

The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object. If the space is of pagesize or larger, the memory returned will be page-aligned.

Allocation of a zero size object returns a pointer to a zero size object.

RETURN VALUES
The malloc() and calloc() functions return a pointer to the allocated space if successful; otherwise, a null pointer is returned and errno is set to ENOMEM.

SEE ALSO

STANDARDS
The malloc() function conforms to ANSI X3.159-1989 (``ANSI C'').

HISTORY
The present implementation of malloc() started out as a filesystem on a drum attached to a 20-bit binary challenged computer built with discrete germanium transistors, and it has since graduated to handle primary storage rather than secondary.