BSD 4_4 development
[unix-history] / usr / share / man / cat3 / malloc.0
MALLOC(3) BSD Programmer's Manual MALLOC(3)
N\bNA\bAM\bME\bE
m\bma\bal\bll\blo\boc\bc, - general memory allocation function
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdl\bli\bib\bb.\b.h\bh>\b>
_\bv_\bo_\bi_\bd _\b*
m\bma\bal\bll\blo\boc\bc(_\bs_\bi_\bz_\be_\b__\bt _\bs_\bi_\bz_\be);
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The m\bma\bal\bll\blo\boc\bc() function allocates uninitialized space for an object whose
size is specified by _\bs_\bi_\bz_\be. The m\bma\bal\bll\blo\boc\bc() 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 _\bp_\ba_\bg_\be_\bs_\bi_\bz_\be or larger,
the memory returned will be page-aligned.
R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
The m\bma\bal\bll\blo\boc\bc() function returns a pointer to the allocated space if suc-
cessful; otherwise a null pointer is returned.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
brk(2), pagesize(2), free(3), calloc(3), alloca(3), realloc(3),
memory(3)
S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
The m\bma\bal\bll\blo\boc\bc() function conforms to ANSI C X3.159-1989 (``ANSI C '').
B\bBU\bUG\bGS\bS
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 be-
cause the size is rounded up. It is optimized for sizes that are powers
of two.
4th Berkeley Distribution June 4, 1993 1