Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21246

out of memory during a loop of txt file

$
0
0
I use this routine to read txt file line by line...

i loop approx 123 files each file are of 45/80 MB. (approx 358.000 line per file)

i use (pseudo code):

...
for each file in my dir

TEST1(name_file )

next
...

Sub TEST1(name_file )

Dim temp As String
Dim MyArray() As String
Dim FileID As Integer

FileID = FreeFile
Open "C:\TEST\" & name_file For Binary Access Read As #FileID
temp = Space(LOF(FileID))
Get #FileID, , temp
Close #FileID

Erase MyArray()
MyArray() = Split(temp, vbNewLine)

temp = ""
Dim X As Long

For X = LBound(MyArray()) To UBound(MyArray())
temp = MyArray(X) 'Is the; current; Line
Next

End Sub


but after the 3thfile processed have Out of Memory!!!!

Viewing all articles
Browse latest Browse all 21246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>