$replace = "/^(([a-z]+?[^a-z]+?){".($count)."})(".$typedmask.")(.*)/iS";
$with = "$1<error-start sourcetext=".$corr['sourcetext']." id=".$corr['id']."
group=\"".$corr['grupper']."\" class=\"".$corr['ordklasse']."\"
corrected-from=\"".$corr['typed']."\"
corrected-to=\"".$corr['corrected']."\">$3<error-end
sourcetext=".$corr['sourcetext']." id=".$corr['id'].">$4";
$text = preg_replace ($replace,$with,$text,1);


Above preg_replace works as expected, I have it inside a loop that processes 1000
texts and replaces a total of 30000 words.

The problem is that it accumulates memory up to 200MB, that isn't freed again until
the script completes?

It runs for about 1 - 2 minutes and allocates more and more memory.

If I comment out the preg_replace the memory usage looks normal, so I'm pretty sure
that is where the problem is?

My question is basically, is it something in my reg. exp. that it totally nuts or is
it normal behaviour for preg_replace to allocate memory and not free it again until
the script ends?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to