[Gambas-user] wait and stack overflow

Benoit Minisini gambas at ...1...
Fri Oct 27 21:24:54 CEST 2006


On Friday 27 October 2006 21:18, Rob wrote:
> On Friday 27 October 2006 14:11, olinux wrote:
> > Is somebody can explain me why:
> > while toto<>0
> > wait
> > whend
> > generate a stack overflow ????
>
> Because it's an infinite loop and every time the "wait" executes,
> the interpreter adds a context to the stack.  So if it's in some
> event handler that gets called during the wait, e.g. in a timer,
> you end up with 25,000 copies of that event handler on the
> stack.
>
> Can't really be any more specific without seeing the project.
>
> Rob
>

This loop works without any problem, unless there *is* an infinite recursion. 
That means that WAIT calls an event handler that calls your loop again. Just 
trace your program to detect it.

If this is not the case, then it is a bug in the interpreter. Just tell your 
version of gambas you use then.

Regards,

-- 
Benoit Minisini





More information about the User mailing list