alloca()

Defined in alloca.h, this function allocates local storage in a function. It returns a pointer to size bytes of memory. The default implementation returns an eight-byte aligned block of memory on the stack.

Memory returned from alloca() must never be passed to free(). Instead, the memory is de-allocated automatically when the function that called alloca() returns.

Note

alloca() must not be called through a function pointer. You must take care when using alloca() and setjmp() in the same function, because memory allocated by alloca() between calling setjmp() and longjmp() is de-allocated by the call to longjmp().

This function is a common nonstandard extension to many C libraries.

Show/hideSyntax

void *alloca(size_t size);

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0492F
Non-ConfidentialID091611