Developer's Daily | Unix by Example |
main | java | perl | unix | dev directory | web log |
alloca ? memory allocator |
#include <stdlib.h> void *alloca( size_t size); |
The alloca function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed on return. |
The alloca function returns a pointer to the beginning of the allocated space. If the allocation failed, a NULL pointer is returned. |
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. |
The alloca function is machine dependent. |
brk(2), pagesize(2), calloc(3), malloc(3), realloc(3) |