RAD Studio |  |

stackavail

Header File

malloc.h

Category

Memory Routines

Prototype

size_t stackavail(void);

Description

Gets the amount of available stack memory.

stackavail returns the number of bytes available on the stack. This is the amount of dynamic memory that alloca can access.

Return Value

stackavail returns a size_t value indicating the number of bytes available.

Example

Copy Code

     #include <malloc.h>
     #include <stdio.h>

     int main(void)
     {
       char *buf;

       printf("\nThe stack: %u\tstack pointer: %u", stackavail(), _SP);
       buf = (char *) alloca(100 * sizeof(char));
       printf("\nNow, the stack: %u\tstack pointer: %u", stackavail(), _SP);
       return 0;
     }

Portability

POSIX | Win32 | ANSI C | ANSI C++
| + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!