From:             xl269 at cam dot ac dot uk
Operating system: debian gnu/linux lenny
PHP version:      5.3CVS-2008-09-26 (CVS)
PHP Bug Type:     Performance problem
Bug description:  memory leak on unset(array)

Description:
------------
unset(array) doesn't free up all the memory. or perhaps setting elements
in an array is using up memory that can't be freed. whatever, I dunno how
Zend works.

basically, bug 41713 isn't actually fixed.

also it'd be helpful if someone explains why unset() seems to use up ~200B
of memory regardless. in a CLI daemon that's a significant memory leak.


Reproduce code:
---------------
<?php
define('LF', chr(10));

$a = null;
echo memory_get_usage().LF;

$a = str_repeat("test", 65536);
echo memory_get_usage().LF;

unset($a);
echo memory_get_usage().LF;

for ($i=0; $i<65536; $i++) { $a[] = "test"; }
echo memory_get_usage().LF;

unset($a);
echo memory_get_usage().LF;

?>


Expected result:
----------------
627560
889944
627776
12163304
62xxxx


Actual result:
--------------
627560
889944
627776
12163304
888744



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

Reply via email to