On Tue, 2007-01-09 at 01:11 +0100, Jochem Maas wrote: > Robert Cummings wrote: > > On Mon, 2007-01-08 at 23:59 +0100, Jochem Maas wrote: > >> Bill Moran wrote: > >>> With reference to: > >>> http://bugs.php.net/bug.php?id=40067 > >>> > >>> I'm confused as to why this was marked bogus, and the message that > >>> marked as such doesn't give much insight. > >>> > >>> It would seem to me that infinite recursion within PHP is a bug. > >>> Shouldn't the interpreter catch this sort of thing before it > >>> coredumps? Or is the design philosophy for PHP different than > >>> that? > >> the way I understand it is that there is no decent way for the engine to > >> tell the difference between a piece of recursive code that will complete > >> and a piece of recursive code that will never complete ... so the only > >> sane solution is to leave it up to user land code to make sure the recursive > >> loop is not infinite. > >> > >> put another way if the engine catches/stops what it *thinks* is an infinite loop > >> then how would stopping the loop at an arbitrary location be any better > >> than dumping core? > > > > Ummm, on many systems you end up with a core dump with the following > > name: core.<pid>. Now multiply that by 1000 at 16 to 32 megs a piece. > > Not fun :) > > core dump files are only generated in debug builds I thought. I may well be > completely wrong though :-) It is configurable, but often forgotten :) > > Anyways, the core dump happens because memory is exhausted and the > > engine is unable to allocate anymore. It should be possible for PHP to > > exit gracefully upon finding itself out of memory... Possibly it could > > allocate another 1k and write to the error logfile on which line it was > > running when it ran out of memory. > > that does sound sane. > > > Or better yet, maybe a > > debug_backtrace() output *drool*. > > wouldn't the backtrace be massive, leaving you with the same problem as > indicated by your point regarding the core dump files? Good point... maybe just the last 10 to 20 calls... Quite likely the recursion will be seen then :) Admittedly, one can usually grab the same info from the core dump. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php