Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Assessing Memory Conditions


StackSpace

Use the StackSpace function to find out how much space there is between the bottom of the stack and the top of the application heap.

FUNCTION StackSpace: LongInt;
DESCRIPTION
The StackSpace function returns the current amount of stack space (in bytes) between the current stack pointer and the application heap at the instant of return from the trap.

SPECIAL CONSIDERATIONS
Ordinarily, you determine the maximum amount of stack space you need before you ship your application. In general, therefore, this routine is useful only during debugging to determine how big to make the stack. However, if your application calls a recursive function that conceivably could call itself many times, that function should keep track of the stack space and take appropriate action if it becomes too low.

ASSEMBLY-LANGUAGE INFORMATION
The registers on exit for StackSpace are
Registers on exit
D0Number of bytes between stack and heap

RESULT CODES
noErr 0No error

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996