On dinsdag, sep 2, 2003, at 08:16 Europe/Brussels, [EMAIL PROTECTED] wrote:
Message: 4 Date: Mon, 1 Sep 2003 22:59:27 -0600 Subject: Re: The Directory Walker revisited From: Alex Rice <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED]
On Monday, September 1, 2003, at 01:11 PM, wouter wrote:
I am sure you can figure out why.
What is this, a riddle? Actually I can't, which is why I posted my question.
< The value is the size in bytes of the CPU call stack. The actual function call depth limit will depend on such factors as the CPU type, how functions are called, and the number of parameters passed to each function. >
There is a big difference between the mechanism of a recursive handler/routine and a repeat loop.
Each handler/routine that calls itself is not finished. So all pointers and params are kept in the stack memory. If the recursive handler has reached the end of its purpos, it has to trace back and eventually finish other statements after the recursive call and finish itself for each instance of itself. This mechanism can grow the heap and stack in memory beyond acceptable limits if there is no recursionLimit. And if memory management in the app and/or in the operating system is not protected, a collision or an overwrite could happen which results in a crash of the app and in the worst case of the operating system.
A repeat loop on the contrary has a complete different memory management, does not have to trace back and lives mostly, if not totally, in the heap.
Are you saying the recursionLimit is so broken and or unhelpful that you have to rewrite something as without recursion?
Though recursion can be a very elegant way of programming, only use it if you are sure the amount of recursion is not going to exceed its limit .
While using a try-catch structure is preventing the blocking by a error dialog, it sure is no solution to be used in an app that is meant to be used by others as it is not fulfilling its end.
Alex Rice <[EMAIL PROTECTED]> | Mindlube Software | http://mindlube.com
Have a nice afternoon, WA
PS same as before : I appologize already in advance if the answer is redundant because of the slow mail traffic over here.
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
