The GNU C Library - Unconstrained Allocation

Node: Unconstrained Allocation Next: Obstacks Prev: Dynamic Allocation and C Up: Memory Allocation

Unconstrained Allocation

The most general dynamic allocation facility is malloc . It allows you to allocate blocks of memory of any size at any time, make them bigger or smaller at any time, and free the blocks individually at any time (or never).

Basic Allocation Simple use of malloc .
Malloc Examples Examples of malloc . xmalloc .
Freeing after Malloc Use free to free a block you
got with malloc .
Changing Block Size Use realloc to make a block
bigger or smaller.
Allocating Cleared Space Use calloc to allocate a
block and clear it.
Efficiency and Malloc Efficiency considerations in use of
these functions.
Aligned Memory Blocks Allocating specially aligned memory:
memalign and valloc .
Heap Consistency Checking Automatic checking for errors.
Hooks for Malloc You can use these hooks for debugging
programs that use malloc .
Statistics of Malloc Getting information about how much
memory your program is using.
Summary of Malloc Summary of malloc and related functions.


Next: Obstacks Up: Memory Allocation