|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-06-22 07:49 UTC] rusa959 at gmail dot com
[2016-06-22 08:12 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2016-06-22 08:12 UTC] nikic@php.net
[2016-06-22 08:53 UTC] rusa959 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 09:00:02 2026 UTC |
Description: ------------ In php versions 7.0.6, 5.6.22, 5.6.16, 5.4.35 I have construct object that have anonymous function in his field named "callback". When i am trying to unset object - object is still exists, memory that allocated to object is not released. In php version 5.3.10 memory is released. Test script: --------------- <?php class Leak { protected $callback; public function set() { $this->callback = function(){}; } } $base_usage = memory_get_usage(); for($i=0;$i<12;$i++) { echo 'step-1 ' . (memory_get_usage() - $base_usage) . PHP_EOL; $leak = new Leak(); $leak->set(); unset($leak); echo 'step-2 ' . (memory_get_usage() - $base_usage) . PHP_EOL; } echo 'step-3 ' . (memory_get_usage() - $base_usage) . PHP_EOL; Expected result: ---------------- step-1 344 step-2 840 step-1 840 step-2 840 step-1 840 step-2 840 step-1 840 step-2 840 step-1 840 step-2 840 step-1 840 .... Actual result: -------------- step-1 344 step-2 840 step-1 840 step-2 1328 step-1 1328 step-2 1816 step-1 1816 step-2 2304 step-1 2304 step-2 2792 step-1 2792 step-2 3280 ....