Propeller Manual

Table Of Contents
_STACK – Spin Language Reference
_STACK
Constant: Pre-defined, one-time settable constant for specifying the size of an application’s
stack space.
CON
_STACK =
Expression
Expression is an integer expression that indicates the number of longs to reserve for
stack space.
Explanation
_STACK is a pre-defined, one-time settable optional constant that specifies the required stack
space of an application. This value is added to
_FREE if specified, to determine the total
amount of stack/free memory space to reserve for a Propeller application. Use
_STACK if an
application requires a minimum amount of stack space in order to run properly. If the
resulting compiled application is too large to allow the specified stack space, an error
message will be displayed. For example:
CON
_STACK = 3000
The _STACK declaration in the above CON block indicates that the application needs to have at
least 3,000 longs of stack space left over after compilation. If the resulting compiled
application does not have that much room left over, an error message will indicate by how
much it was exceeded. This is a good way to prevent successful compiles of an application
that will fail to run properly due to lack of memory.
Note that only the top object file can set the value of
_STACK. Any child object’s _STACK
declarations will be ignored. The stack space reserved by this constant is used by the
application’s main cog to store temporary data such as call stacks, parameters, and
intermediate expression results.
Page 202 · Propeller Manual v1.1