実際どれだけメモリを消費しているか知りたい方へ
こんなテストコードを書いてみました。一応同じ行に表示するようにしてあります。カーソルも消したかったんですがうまくいかず。。。(Poderosa利用)
<?php function cf() { create_function('$match', '$constant = $match[1];' . 'return (AgaviConfig::has($constant) ? AgaviConfig::get($constant) : "%".$constant."%");' ); } echo ' loop waste total', PHP_EOL; for($i=0; $i < 20000; $i++) { $before = $after = 0; $before = memory_get_usage(); cf($i); $after = memory_get_usage(); printf("\r" . '[%06d] %5d %9d', $i, $after - $before, $after); } ?>