[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


alloca

Allocates memory quickly on the stack.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS
Palm OS
Win32


NOTE

The function alloca() is defined in malloc.h for Win32 headers.
Prototype:
#include <alloca.h>
void *alloca(size_t nbytes);
Parameters:

Parameters for this function are:

nbytes  
size_t  
number of bytes of allocation  

Remarks:

This function returns a pointer to a block of memory that is nbytes long. The block is on the function's stack. This function works quickly since it decrements the current stack pointer. When your function exits, it automatically releases the storage.


NOTE

The AltiVec version of alloca() allocates memory on a 16 byte alignment.

If you use alloca() to allocate a lot of storage, be sure to increase the Stack Size for your project in the Project preferences panel.


NOTE

The alloca function does not apply to all embedded/ RTOS systems Please read the release notes.
Return:

If it is successful, alloca() returns a pointer to a block of memory. If it encounters an error, alloca() returns NULL.

See Also:

"calloc"

"free"

"malloc"

"realloc")


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000