Go to the previous, next section.

Summary of malloc-Related Functions

Here is a summary of the functions that work with malloc:

void *malloc (size_t size)
Allocate a block of size bytes. See section Basic Storage Allocation.

void free (void *addr)
Free a block previously allocated by malloc. See section Freeing Memory Allocated with malloc.

void *realloc (void *addr, size_t size)
Make a block previously allocated by malloc larger or smaller, possibly by copying it to a new location. See section Changing the Size of a Block.

void *calloc (size_t count, size_t eltsize)
Allocate a block of count * eltsize bytes using malloc, and set its contents to zero. See section Allocating Cleared Space.

void *valloc (size_t size)
Allocate a block of size bytes, starting on a page boundary. See section Allocating Aligned Memory Blocks.

void *memalign (size_t size, size_t boundary)
Allocate a block of size bytes, starting on an address that is a multiple of boundary. See section Allocating Aligned Memory Blocks.

int mcheck (void (*abortfn) (void))
Tell malloc to perform occasional consistency checks on dynamically allocated memory, and to call abortfn when an inconsistency is found. See section Heap Consistency Checking.

void *(*__malloc_hook) (size_t size)
A pointer to a function that malloc uses whenever it is called.

void *(*__realloc_hook) (void *ptr, size_t size)
A pointer to a function that realloc uses whenever it is called.

void (*__free_hook) (void *ptr)
A pointer to a function that free uses whenever it is called.

struct mstats mstats (void)
Return information about the current dynamic memory usage. See section Statistics for Storage Allocation with malloc.

Go to the previous, next section.