Page 1 of 1

Call Procedure inside Procedure = Overflow !?

Posted: Wed Jun 15, 2005 12:27 am
by va!n
Hi!
I am trying to write a small procedure with some differents if conditions inside... if the condition check is TRUE, i have to call the Proecdure again! (also its like recursive coding!?)

All works fine, for some loops... then it will crash or with enabled debugger i got a message "invalid memory adress" !!

I think each time when calling a procedure the stack pointer will increase and after some time its a overflow!? Is there any way to solve the problem with another coding style or how ever? thanks

here is a very small example what i mean! But please not, my procedure will exit after some loops! Following example will never end, its just only to show you what i mean when talking about "calling the same procedure inside a procedure)

Code: Select all

Procedure Overflow(test)
  If test = 1 : Overflow(1) : EndIf
EndProcedure

Overflow(1)

Posted: Wed Jun 15, 2005 12:37 am
by Dreglor
this some times happens with recursive code
what you have is a infinity loop of allocating memory until the limit is reached which causes a over flow

all i can say do could make a point were it can get out and close all procedures

Posted: Wed Jun 15, 2005 10:02 am
by El_Choni