stack overflow

Just starting out? Need help? Post your questions and find answers here.
ludoke
Enthusiast
Enthusiast
Posts: 153
Joined: Fri Jul 08, 2016 5:35 pm
Location: Essen (Belgium)

stack overflow

Post by ludoke »

Why I get stack overflow ?
How to avoid this ?
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: stack overflow

Post by wilbert »

A cause could be a recursive procedure (where a procedure is calling itself).
Are you using those kind of procedures ?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: stack overflow

Post by skywalk »

I got a tricky Stack Overflow when defining a very large structure within a Procedure.
Thanks to the forum for suggesting to define it Globally.
That fixed the problem. I had reached a RAM limit for local procedure stacks.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
ludoke
Enthusiast
Enthusiast
Posts: 153
Joined: Fri Jul 08, 2016 5:35 pm
Location: Essen (Belgium)

Re: stack overflow

Post by ludoke »

I use only global variables,but I think maybe must find the recursive procedures.
But how do I find such a recursive procedure.?
ludoke
Enthusiast
Enthusiast
Posts: 153
Joined: Fri Jul 08, 2016 5:35 pm
Location: Essen (Belgium)

Re: stack overflow

Post by ludoke »

thanks Wilbert ,it was a recursive procedure ,I find it
Procedure zend() ;zend Vg now en VA now
zend$="":DA_VA$="":DA_VG$=""
VA=Val(ar$(0)):VG=Val(ar$(2))
DA_va_now.i=(4096*VA_now)/Va: DA_VA$=Str(DA_va_now) ;zet VAnow om naar string
DA_vg_now.i=(4096*VG_now)/Vg:DA_VG$=Str(DA_vg_now)
zend$="<"+DA_vg$ +","+DA_VA$+","+relais$+">";
zend() <------------------------- here was the problem
endprocedure
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: stack overflow

Post by wilbert »

Good to hear you were able to solve the problem :)
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply