#46180 [Opn->Bgs]: memory leak on unset(array)
ID: 46180
Updated by: johannes@php.net
Reported By: xl269 at cam dot ac dot uk
-Status: Open
+Status: Bogus
Bug Type: Performance problem
Operating System: debian gnu/linux lenny
PHP Version: 5.3CVS-2008-09-26 (CVS)
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
PHP doesn't free memory directly to the system but tries to reduce the
number of system allocations therefore the memory usage doesn'T directly
show "leaks."
Previous Comments:
------------------------------------------------------------------------
[2008-09-26 10:13:39] xl269 at cam dot ac dot uk
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 this bug report at http://bugs.php.net/?id=46180&edit=1
Thread (2 messages)