Re: Re: memory issues with PHP_ProcWatch
| From: | Joshua Eichorn | Date: | Tue, 11 Nov 2003 22:54:50 +0000 |
| Subject: | Re: Re: memory issues with PHP_ProcWatch | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23480@lists.php.net to get a copy of this message | ||
Michael Wallner wrote:
I wrote:-joshWell, I finally brought this down to ~1k per run - with *tons* of unsets, in fact each local var has to be unset... Didn't know that PHP has memory for breakfast... just weird!dunno if I should cry or laugh... I got it: From the moment you use recursive functions php sucks memory. That's it (I think ;-). That sounds about right, i rememeber that we had big speed ups and memory reductions in phpDocumentor when Greg rewrote some code to stop using recursion.
I reproduced that with really simple scripts and memory_get_usage(), try yourself: --- suck.php --- #!/usr/bin/php <?php function run() { echo round(memory_get_usage()/1024)."k\n"; sleep(@$argv[1]); run(); } run(); ?> --- /suck.php --- --- norm.php --- #!/usr/bin/php <?php function run() { echo round(memory_get_usage()/1024)."k\n"; sleep(@$argv[1]); } while(true) { run(); } ?> --- /norm.php --- Regards,