Re: suggestion: recursive calls
| From: | Ronald van Raaphorst | Date: | Fri, 05 Sep 2003 11:20:11 +0000 |
| Subject: | Re: suggestion: recursive calls | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161739@lists.php.net to get a copy of this message | ||
Yep, but then I expect a timeout error because my script is running more
than say 20 seconds...
Ronald
"Marco Schuler" <marco.schuler@scopein.ch> schreef in bericht
news:1062674134.2689.8.camel@opal...
> Hi
>
> Am Don, 2003-09-04 um 12.40 schrieb Ronald van Raaphorst:
> > I normally program in clarion (www.softvelocity.com) and an infinite
> > recursive call will cause a heap overflow...
> >
> > As I only got a "This page cannot be displayed" page, an error must have
> > occurred, but it's not displayed...
>
> A computer cannot decide when a recursion is to deep. Imagine traversing
> a realy big tree. There a recursion can get realy deep.
>
> I don't know about the internals of php. But as it is an interpreter
> language, I would say that all variables or even the parsing tree are
> located on the heap. So this heap will probably be quite big! Thus, to
> produce a heap overflow will take a rather long time. (Correct me if I
> am wrong with my tought)
>
> A workaround could be that you have a counter (static variable!) in your
> recursion procedure or methode respectively. You increment this counter
> on every entry into the procedure and compare it to a limit that _you_
> specifiy.
>
> --
> Cheers!
> Marco
>
>
> > At first I thought I had lost contact with the site, but then, after a
lot
> > of tracing, I found the source of the error.
> >
> > Ronald
> >
> >
> >
> > "Marek Kilimajer" <kilimajer@webglobe.sk> schreef in bericht
> > news:3F57156B.9070902@webglobe.sk...
> > > I don't think it is even possible, if the recursive calls don't seem
> > > infinite to inteligent human being, how should a stupid computer
program
> > > find out.
> > >
> > > Ronald van Raaphorst wrote:
> > >
> > > > Hi all,
> > > >
> > > > Not a real bug, but a suggestion:
> > > > It would be nice if inifite recursive calls would somehow give an
error.
> > > > I spend quite some time to find the error in my php script.
> > > >
> > > > Ronald
> > > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >