Recursion limit
Richmond Mathewson
richmondmathewson at gmail.com
Tue Jul 4 03:59:34 EDT 2017
Well I'm not doing infinite recursion:
MouseUp Script inside button "GO2" sending "mouseDown" to button "GO2"
onmouseUp
put0 intoSTOPP
ifintersect(img "ball1",img "stop") then
put1 intoSTOPP
endif
ifintersect(img "ball2",img "stop") then
put1 intoSTOPP
endif
ifintersect(img "ball3",img "stop") then
put1 intoSTOPP
endif
ifintersect(img "ball4",img "stop") then
put1 intoSTOPP
endif
ifSTOPP = 0 then
send"mouseDown" tobtn "GO2"
endif
endmouseUp
Richmond.
On 7/4/17 10:50 am, Mark Waddingham via use-livecode wrote:
> 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.
>
More information about the use-livecode
mailing list