STACK directive sets the maximum stack depth permitted
for the script. The stack depth increases by one for every function
call and upon entering most block or looping statements. Exceeding
the stack limit will generate a "Stack overflow" message and
terminate the script. The default limit is 250; -1 sets an infinite
(no) limit. Increasing the stack limit is needed only by scripts that
make heavy use of recursion and will intentionally exceed the default
limit. The usual cause of a stack overflow message is unintentional
infinite recursion: a function calling itself (directly or through
other functions) in a loop without returning.
As it is a directive,
<STACK> must appear before the first
function in the script. The stack limit can also be modified at run
time with the
vxcp function (here), which
overrides this directive.
<STACK> directive was added in version 3.0.947100000 20000105.
Setting a large or infinite stack limit can allow a script to consume inordinate amounts of memory and CPU, possibly bringing other processes or even the entire operating system down.