|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-01 15:29 UTC] djgrrr at gmail dot com
Description: ------------ The PHP version is actually Irrelevant If you use create_function many times in a script to make lambda functions, it will use more and more memory. Now, I know that this is the expected result, but it would be really good to have a function like free_function or delete_function that could be used to remove the lambda functions, and free up the memory they use. Obviously this function would have to be limited to only lambda function, and it not be possible to use it on normal functions. Personally, I think this is VERY essential to the CLI version of PHP as many CLI PHP programs do not often restart, but keep running, simply rehashing its config and any modules (using lambda functions) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 21:00:01 2025 UTC |
My reproduction code: <? ini_set('display_errors',TRUE); ini_set('memory_limit','2M'); error_reporting(E_ALL); for ($i=0;$i<30000;$i++) { $func=create_function('$m','return($m);'); unset($func); echo '. '; } echo '<h1>OK</h1>'; ?> It breaks with "Fatal error: Allowed memory size of 2097152 bytes exhausted..." error. Is there any way, to solve this problem?You could write it like this: isset($fn)?$fn:$fn=create_function('$v', 'echo $v;');