I've written a simple console app, what is happening is I read the files in and then eliminate dups with the dictionary object and write those out to a file. The dictionary object ends up with over a million entries. After the programs completes, my memory usage remains high and if I delete the files from the directory, the memory usage drops. I also get the same behaviour with streamwriter. Any thoughts?
Imports System.IO
Module CreateFileList
Sub Main(ByVal sArgs() AsString)
Dim LineNumber AsInteger = sArgs(0)
Dim dirs AsString() = Directory.GetFiles("f:\combo", "line*")
Dim dir AsString
Dim InputFile AsString = "line"
Dim i AsInteger = 0
Dim ParseString AsNew System.Text.StringBuilder
Dim ListDict AsNewDictionary(OfString, Integer)
Dim TextLine1 AsString
ForEach dir In dirs
Dim objReadera0a AsNew System.IO.StreamReader(dir)
DoWhile objReadera0a.Peek() <> -1
TextLine1 = objReadera0a.ReadLine()
If ListDict.ContainsKey(TextLine1) Then
ListDict.Item(TextLine1) += 1
Else
ListDict.Add(TextLine1, 1)
EndIf
Loop
objReadera0a.Dispose()
objReadera0a.Close()
System.IO.File.Delete(dir)
Next
i = 0
ForEach pair In ListDict
i += 1
My.Computer.FileSystem.WriteAllText("f:\file" & i & ".txt", pair.Key & vbCrLf, True)
Next
EndSub
End Module
Imports System.IO
Module CreateFileList
Sub Main(ByVal sArgs() AsString)
Dim LineNumber AsInteger = sArgs(0)
Dim dirs AsString() = Directory.GetFiles("f:\combo", "line*")
Dim dir AsString
Dim InputFile AsString = "line"
Dim i AsInteger = 0
Dim ParseString AsNew System.Text.StringBuilder
Dim ListDict AsNewDictionary(OfString, Integer)
Dim TextLine1 AsString
ForEach dir In dirs
Dim objReadera0a AsNew System.IO.StreamReader(dir)
DoWhile objReadera0a.Peek() <> -1
TextLine1 = objReadera0a.ReadLine()
If ListDict.ContainsKey(TextLine1) Then
ListDict.Item(TextLine1) += 1
Else
ListDict.Add(TextLine1, 1)
EndIf
Loop
objReadera0a.Dispose()
objReadera0a.Close()
System.IO.File.Delete(dir)
Next
i = 0
ForEach pair In ListDict
i += 1
My.Computer.FileSystem.WriteAllText("f:\file" & i & ".txt", pair.Key & vbCrLf, True)
Next
EndSub
End Module