Выдает ошибку при считывании большого файла
I need to order according to the text of a line of text reading, when I read the file size of about 100MB in all normal, but when I read the file size is about 300MB when the memory error occurred.
деталь функции как показано ниже:
var filePath = @"D:\junk\test.txt"; var fileSize = new FileInfo(filePath).Length; var viewSize = fileSize List<string> rowArray = new List<string>(); using (var mm = MemoryMappedFile.CreateFromFile(filePath, FileMode.Open, null, 0, MemoryMappedFileAccess.Read)) using (var stream = mm.CreateViewStream(0, viewSize, MemoryMappedFileAccess.Read)) using (var reader = new StreamReader(stream, Encoding.UTF8)) { rowArray.Add(reader.ReadLine()); }
The rowArray is provided to the LISTVIEW data source, LISTVIEW uses a virtual mode
Что я уже пробовал:
I use the third party software to read the file, whether it is the size of 100MB or 300MB size, everything is normal
Why I don't use this method of File.ReadAllLines is that it takes 28 seconds to read the 300MB file, and the Third party software takes about 10 seconds So I used the MemoryMappedFile technology, but unfortunately, the 300MB file size out of memory error.
OriginalGriff
Ответ обновлен - комментарии в данный момент не отображаются, это известная ошибка, и они работают над ней.