Re: [PHP-DEV] PHP 4.0 Bug #2004: recursive call limitation From: Andi Gutmans (andi <email protected>)
Date: 08/10/99

At 09:13 AM 8/10/99 +0000, gregori wrote:
>That's a weird question ... the deepest nesting level should be set by
>the machine (memory + swap memory) and not by the software ?!
>
>As far as I remember my computer science lesson we could have :

Well you were maybe a good theoretical student but not a good practical
student. In just about any OS the stack doesn't really grow until it meets
the heap. Usually you have around 4 gig's of virtual heap but the stack is
limited to much much less than that. It can usually only grow like 10-20MB,
often even much less.
Don't believe everything your lecture tells you. For example, login to a
UNIX account and run the limit command. You'll see a nice stack limit.

>--------------------
>| Stack |
>| | |
>| \ / |
>| |
>| |
>| |
>| / \ |
>| | |
>| heap |
>|------------------|
>
>
> Anyway, maybe you have done something different to speed function
>calls.
>
>I think we need at least a level of one million, if we want to be safe
>... but, if we keep a limit of 8192, PHP will never have the name of
>language.

Bullshit. ASP has a similar limited and it's a computer language. If you
need to run scripts that have 1 million nesting level than you shouldn't be
using a scripting language and you should be using C, Fortran, or C++.

>Maybe I'm wrong ... maybe I'm the only one who scare about that ...
>
>but a compile-time switch will be more than a good news ... and a level
>of 1 million will be safe.

After all I said, it can be improved, for example, in zend_execute.c you
can change on line 860+ the do_alloca and free_alloca macro's to use
emalloc and efree. However, it'll slow things down a bit.

Andi

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>