OK I am working on a project for a friend. It loads all php files in a specified folder and looks for text in them and if it finds a text it replaces it, then it saves the file and moves on to the next.

so it is like
Code:
txt = txt.Replace("j", "from")
there are around 13,000 lines like this that it searches the files with, it always runs out of memory at the same line.

I need a way to cut down on the memory usage, it is already running on a background worker, but didnt seem to help any.