11,000!! No wonder there's a problem. How big are your files? If a file is 1 kilobyte then after processing one file you'll have used 11 megabytes of memory just to store all the strings.

You might try using a StringBuilder instead of a String. I've never actually used StringBuilder.Replace but StringBuilders are generally more efficient than Strings when joining multiple substrings together so I'd guess that they would be when replacing substrings too.