Hi all
In this example (using php-5.4.11 on Linux) the memory will grow non-stop:
for ( $fp = fopen('/dev/urandom', 'rb'); true;) {
eval ('$ano_fnc = function() {$x = "'.bin2hex(fread($fp, mt_rand(1,
10000))).'";};');
echo "Mem usage: ".memory_get_usage()."\n";
}
But in this example not:
for ( $fp = fopen('/dev/urandom', 'rb'); true;) {
eval ('$ano_fnc = function() {$x = "'.bin2hex(fread($fp,
10000)).'";};');
echo "Mem usage: ".memory_get_usage()."\n";
}
The only different in the second example is the fixed body length of the
eval()-created anoymous function.
I wondering why the memory in the second code-example will be freed at
some point while in the first example not.
I don't think it's a PHP-Bug but i also not understand this behavior.
Is there one who can explain this?
Thank you very much.
Greetings
Hans-Juergen Petrich
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php