Re: memory issues with PHP_ProcWatch
| From: | Michael Wallner | Date: | Sun, 09 Nov 2003 19:06:53 +0000 |
| Subject: | Re: memory issues with PHP_ProcWatch | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23375@lists.php.net to get a copy of this message | ||
I wrote:
> Well, 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 ;-).
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,
--
Michael - < mike(@)php.net >