|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-05-10 04:28 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2015-05-10 04:28 UTC] requinix@php.net
[2015-11-17 14:14 UTC] chris at willowsconsulting dot ie
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
Description: ------------ I am seeing a memory leak when using eval() to declare a closure in certain cases. In the below example, the memory usage increases by about 1MB when it should remain relatively constant. Test script: --------------- <?php function test() { $php_code = '$run = function() {'; foreach (range(1, 15) as $a) { $php_code .= 'if (1 == 1) { $aaaaaa = true; } else { $aaaaaa = false; }'; } $php_code .= '};'; eval($php_code); } echo number_format(memory_get_usage())."\n"; for ($i = 0; $i <= 1000; $i++) { test(); } echo number_format(memory_get_usage())."\n"; Expected result: ---------------- 224,440 224,440 Actual result: -------------- 224,440 1,271,128