STACK - set stack limit

SYNOPSIS

<STACK=n>


DESCRIPTION
The 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.


EXAMPLE

<STACK=500>

<A NAME=bigtreewalk>
  ...
</A>


CAVEATS
The <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.


SEE ALSO
vxcp


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.