mattsrebatespam
Member
- Joined
- Feb 15, 2005
- Messages
- 10
I am trying to search through a bunch of text files (~25K-50K files) using regular expressions. I have a FileContentsArray array that contains each line of the file. I also have a SearchExpression array that has usually < 10 regular expressions. The code is working, but the memory usage is enormous. The program ties up all the system resources and takes forever to finish. I have managed to isolate the huge memory usage to the second line where I declare the Regexp. Is there any way to not declare it as a new object or to purge the object each time? I have tried to set Regexp = nothing but the memory used remains the same. Any help is greatly appreciated.
For j = 0 To FileContentsArray.Count - 1
For j = 0 To FileContentsArray.Count - 1
Dim Regexp As Regex = New Regex(SearchExpression.Item(k))
If Regexp.Match(FileContentsArray.Item(j)).Success Then
NextIf Regexp.Match(FileContentsArray.Item(j)).Success Then
add the match to a dataset
End If