For the record the patch I had is this: http://mega.ist.utl.pt/~ncpl/zend_stack_protection.txt (it shouldn't apply cleanly due to some changes in zend_try some time ago).

Ah, this is different think - it's more like a nice error message, not preventing stack depletion.

Knowing in advance if you can recurse or not doesn't sound much difficult in theory.. You can get the limit (e.g. with getrlimit) then you can know how much stack does a function call take, and then you can

PHP function calls are not the only things that take stack space.

use a heuristic to make the decision. This isn't 100% secure though (the limited depth approach isn't too), but it's an option. I would love to ear how other VMs handle the problem, like the JVM, anyone?

Probably they use recursion less (which may be done for Zend engine too, but that would require some work). Perl in same situation just runs out of memory.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to