Recursion limit
Mark Waddingham
mark at livecode.com
Tue Jul 4 03:50:04 EDT 2017
On 2017-07-04 09:28, Richmond Mathewson via use-livecode wrote:
> BUT . . .
>
> How can one know how high one can set the recursionLimit before smoke,
> sparks
> and flames are going to start leaping out of the back of the computer?
>
> Or, less frivolously; how can one determine the upper limit on the
> recursionLimit before the
> stack "hangs" (presumably that means the thing will lock solid) ?
The recursionLimit is limited by the size of the C stack (in bytes). I
think on Mac that is 8 Mb by default (although I think you can configure
it using ulimit or some similar command-line trickery).
One thing to check that you aren't (by accident) doing infinite
recursion. i.e. A variant of:
on myFunction
myFunction
end myFunction
Obviously *that* is trivially noticeable as being infinite. However, it
is quite easy to write stuff like this when its buried in lots of lines
of code (hence why LiveCode has a 'recursionLimit').
My general advice would be:
1) Run your routine
2) If it hits the recursionLimit double the recursionLimit property.
3) Goto (1)
If you reach 8Mb limit then put some logging into your code to make sure
it *does* actually need to recurse that deeply.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list