Each task in a system has a fixed size stack associated with it. This stack is allocated when the task is created. As the task executes, the stack is used to contain parameters, return addresses, saved registers, and local variables. The amount of stack space required by a task is dependent on the exact set of routines used. The peak stack usage reflects the worst case of subroutine pushing information on the stack. For example, if a subroutine allocates a local buffer of 1024 bytes, then this data must be accounted for in the stack of every task that invokes that routine.
Recursive routines make calculating peak stack usage difficult, if not
impossible. Each call to the recursive routine consumes n bytes
of stack space. If the routine recursives 1000 times, then
1000 * n
bytes of stack space are required.
Copyright © 1988-2008 OAR Corporation