From:             lesjno at free dot fr
Operating system: XP and UNIX
PHP version:      5.3.1
PHP Bug Type:     Unknown/Other Function
Bug description:  memory leak with EVAL() function

Description:
------------
Memory used by the eval() function is not null and can be important (up to
8Ko) especially if the string is not evaluable.
This memory used can't be released. 
Used in a big loop, the memory used is growing up and I get a memory
error.



Reproduce code:
---------------
$result="";
$memory_used1 = memory_get_usage();
$ch="\$result=22;"; if (@eval($ch)===false) {$result = $ch ;}
$memory_used2 = memory_get_usage();
echo "result=$result ==><b>memory difference =
".($memory_used2-$memory_used1)."<BR></b>\n";

$memory_used1 = memory_get_usage();
$ch="abcdef"; if (@eval($ch)===false) {$result = $ch ;}
$memory_used2 = memory_get_usage();
echo "result=$result ==><b>memory difference =
".($memory_used2-$memory_used1)."<BR></b>\n";

 

Expected result:
----------------
result=22 ==>memory difference = 0
result=abcdef ==>memory difference = 0



Actual result:
--------------
result=22 ==>memory difference = 200
result=abcdef ==>memory difference = 7480



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

Reply via email to