MALLOC
Section: C Library Functions (3)
Index
Return to Main Contents
BSD mandoc
BSD 4
NAME
malloc
- general memory allocation function
SYNOPSIS
Fd #include <stdlib.h>
Ft void *
Fn malloc size_t size
DESCRIPTION
The
Fn malloc
function allocates uninitialized space for an object whose
size is specified by
Fa size .
The
Fn 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.
RETURN VALUES
The
Fn malloc
function returns
a pointer to the allocated space if successful; otherwise
a null pointer is returned.
SEE ALSO
brk(2),
getpagesize(2),
free(3),
calloc(3),
alloca(3),
realloc(3),
memory(3)
STANDARDS
The
Fn malloc
function conforms to
St -ansiC .
BUGS
The current implementation of
malloc
does not always fail gracefully when system
memory limits are approached.
It may fail to allocate memory when larger free blocks could be broken
up, or when limits are exceeded because the size is rounded up.
It is optimized for sizes that are powers of two.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- SEE ALSO
-
- STANDARDS
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 15:52:53 GMT, January 15, 2023