aligned_alloc,
alloca, calloc,
free, malloc,
posix_memalign, realloc,
reallocf, valloc,
mmap, munmap —
memory management functions
Standard C Library (libc, -lc)
#include
<stdlib.h>
void *
aligned_alloc(size_t
alignment, size_t
size);
void *
alloca(size_t
size);
void *
calloc(size_t
nelem, size_t
elsize);
void
free(void
*ptr);
void *
malloc(size_t
size);
int
posix_memalign(void
**ptr, size_t
alignment, size_t
size);
void *
realloc(void
*ptr, size_t
size);
void *
reallocf(void
*ptr, size_t
size);
void *
valloc(size_t
size);
#include
<sys/types.h>
#include <sys/mman.h>
void *
mmap(void
* addr, size_t len,
int prot,
int flags,
int fd,
off_t offset);
int
munmap(void
*addr, size_t
len);
These functions allocate and free memory for the calling process.
They are described in the individual manual pages.
The calloc(),
free(), malloc(), and
realloc() functions conform to
ISO/IEC 9899:1990
(“ISO C90”).
The mmap(),
munmap(), and
posix_memalign() functions conform to
IEEE Std 1003.1-2001 (“POSIX.1”).