中でcreate_functionしている関数をループの中で使うとメモリを消費する

同様に、内部でcreate_functionしている関数を何度も呼び出すとメモリを消費してしまいます。
スコープを抜けてもcreate_functionで作られた関数の実体はそのまま残るということです

<?php
function cf()
{
    create_function('$match',
                    '$constant = $match[1];' .
                    'return (AgaviConfig::has($constant) ? AgaviConfig::get($constant) : "%".$constant."%");'
                    );
}

for($i=0; $i < 20000; $i++) cf();
?>