From:             pearl1985 at interia dot pl
Operating system: Windows XP x64
PHP version:      5.3.0
PHP Bug Type:     Performance problem
Bug description:  To much used memory

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 bug report at http://bugs.php.net/?id=49345&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49345&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49345&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49345&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49345&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49345&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49345&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49345&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49345&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49345&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49345&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49345&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49345&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49345&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49345&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49345&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49345&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49345&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49345&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49345&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49345&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49345&r=mysqlcfg

Reply via email to