#49345 [Opn->Bgs]: To much used memory
| From: | jani@php.net | Date: | Mon, 24 Aug 2009 14:28:23 +0000 |
| Subject: | #49345 [Opn->Bgs]: To much used memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141431@lists.php.net to get a copy of this message | ||
ID: 49345
Updated by: jani@php.net
Reported By: pearl1985 at interia dot pl
-Status: Open
+Status: Bogus
Bug Type: Performance problem
Operating System: Windows XP x64
PHP Version: 5.3.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
unset() does not free any memory.
Previous Comments:
------------------------------------------------------------------------
[2009-08-24 13:50:49] pearl1985 at interia dot pl
Description:
------------
When I was using function lambda in class, I saw that it is using a lot
of operating memory. I saw this error when the script was sending
e-mails reports to users registered in my service.
Reproduce code:
---------------
<?php
class example
{
function test()
{
$var = create_function('', '$a = 1;$b=2;$c=$a+$b;');
$var();
unset($var);
}
}
$example = new example;
for($i=0;$i<=10000;$i++)
{
$example->test();
}
echo 'Results after remove lambda'."\n";
echo 'Memory limit: '.ini_get('memory_limit')."\n";
echo 'Usage: '. round(memory_get_usage()/1024/1024, 1)."\n";
echo 'Peak:'. round(memory_get_peak_usage()/1024/1024, 1);
echo "\n";
?>
Expected result:
----------------
I expected a slight growth of operating memory usage by script. By
using endless loop, I expect the script will be executing even for 2
hours, thanks to correction of appropriate php configuration directive.
Actual result:
--------------
When I used endless loop while(true), php engine ended its work after 2
minutes,generating error "PHP Fatal error: Allowed memory size of
41943040 bytes exhausted (tried to allocate 40961 bytes)"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49345&edit=1