[Gambas-user] wait and stack overflow
olinux
olinux at ...289...
Sat Oct 28 09:55:08 CEST 2006
here is the precise exemple:
for i= 0 to fildir.count-1
prc=exec ["gtar", "-xvf","fichier source","-C", repdest,fichierextract[i]] for read as "rest"
while prc.state = 1
wait
wend
next
version gambas 1.9.44
regards
Olivier Coquet
Benoit Minisini a écrit :
> 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,
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 27/10/2006
More information about the User
mailing list