Format
#include <stdlib.h> /* also in <malloc.h> WIN OS/2 only*/ void *malloc(size_t size);
Language Level: ANSI, POSIX, XPG4, Extension
malloc reserves a block of storage of size bytes.
Unlike calloc, malloc does not initialize all elements to 0.
Heap-specific, tiled, and debug versions of this
function (_umalloc, _tmalloc, and _debug_malloc) are also
available on OS/2.
On Windows, heap-specific, and debug versions of
this function (_umalloc, and _debug_malloc) are also available.
malloc always operates on the default heap.
Return Value
malloc returns a pointer to the reserved
space. The storage space to which the return value points is
suitably aligned for storage of any type of object. The return
value is NULL if not enough storage is available, or if size was
specified as zero.
![]()
calloc -- Reserve
and Initialize Storage
_debug_malloc --
Allocate Memory
_debug_tmalloc -- Reserve Tiled Memory
_debug_umalloc
-- Reserve Memory Blocks from User Heap
free -- Release
Storage Blocks
_mheap -- Query
Memory Heap for Allocated Object
_msize -- Return
Number of Bytes Allocated
realloc -- Change
Reserved Storage Block Size
_tmalloc -- Reserve Tiled Storage Block
_umalloc --
Reserve Memory Blocks form User Heap
<malloc.h>
<stdlib.h>