Stack Overflow error in 1.96?
Archives Forums/Blitz3D Bug Reports/Stack Overflow error in 1.96?
| ||
or rather.... lack of a Stack Overflow error. This code should cause a stack overflow and indeed it seems to as the code stops running after about 43,000 recursions. But it doesn't give an error message. Run this code with Debug on: Global count = 0 Recursive() Function Recursive() count = count + 1 Print count ;Added this because the code isn't producing a stack overflow error Recursive() End Function OK the code is a bit extreme and you're probably never going to get many stack overflows in a real world scenario, but I can imagine the frustration an accidental stack overflow would cause, given that it doesn't seem to be offering an error message any more. |
| ||
I've hit this in release mode before- It's an annoynig little bug that I never bothered to report, I was creating a recursive fill routing. One too many recursions and the program quit, I Didn't figure it out for perhaps a week. |
| ||
isn't stack overflow reported by the OS? Or does this mean Blitz will abort before the overflow actually occurs?. |
| ||
recursion without exit is dangerous. recursion just keeps loading the function in the stack over and over again so of course you get stack overflow. Try it in C and you get the same thing. Its memory management. http://www.devx.com/tips/Tip/14276 It would be dangerous to have a dynamic stack when most users of basic don't need to understand how memory is handled. |
| ||
recursion without exit is dangerous. recursion just keeps Er... I think you've missed the point. You obviously didn't read my first post any further than the thread title and the code.loading the function in the stack over and over again so of course you get stack overflow. Try it in C and you get the same thing. Its memory management. The above code deliberately tries to cause a stack overflow, and it does cause the program to end, but no error is reported. Blitz USED to report a stack overflow in this situation. Now, it does not, which is why I started this thread in Bug Reports. |
| ||
I agree with Cygnus. I'm pretty sure I had a stack overflow and Blitz quit with no warning. Then as far as I know Windows tidies up the local stack once the app is gone. But that's not the point - Blitz doesn't report it, which makes it a bugger to find, and of course this may only be reported (depending on local conditions) after release. |