ALLOCA(3)

NAME
alloca - memory allocator

SYNOPSIS
#include <stdlib.h>

void *alloca(size_t size);

DESCRIPTION
The alloca function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed when the function that called alloca returns to its caller.

RETURN VALUE
The alloca function returns a pointer to the beginning of the allocated space. If the allocation failed, a NULL pointer is returned.

CONFORMING TO
There is evidence that the alloca function appeared in 32v, pwb, pwb.2, 3bsd, and 4bsd. There is a man page for it in BSD 4.3. Linux uses the GNU version. This function is not in POSIX or SUSv3.

BUGS
The alloca function is machine and compiler dependent. Its use is discouraged.

On many systems alloca cannot be used inside the list of arguments of a function call, because the stack space reserved by alloca would appear on the stack in the middle of the space for the function arguments.

SEE ALSO
brk(2), pagesize(2), calloc(3), malloc(3), realloc(3)