Frans_Truyens
asked on
Regex Out of memory on 32 bit Windows
I am using Regex in VB.NET on a 32 bit Windows 7 to read large files, the largest being 2,2 Gigabyte. I am reading the files with:
strText = File.ReadAllText(BigFile, System.Text.Encoding.ASCII )
The problem is that I am getting an out of memory error when reading the files. On smaller files everything works fine
How can I solve that?
strText = File.ReadAllText(BigFile, System.Text.Encoding.ASCII
The problem is that I am getting an out of memory error when reading the files. On smaller files everything works fine
How can I solve that?
ASKER
Won't that be too slow on a 2,2 Giga file?
On the contrary, stream has been created right to access large files: what it should be slow it would be load the whole file in memory, which in your case gives an out-of-memory error. It's obvious that if you have to access a 2.2Gb text file, you can't expect to do it in a few milliseconds like a small file, but using streams reduce the time needed to process the file. I used them in Delphi, and I don't know another technique to access large files other than the use of read stream/ write stream procedures...
Unless you can't change the file's creation, deciding for instance to create 100 small files instead of 1 large file (but this would be possible only if the file has been createdd by your same program :-)
Unless you can't change the file's creation, deciding for instance to create 100 small files instead of 1 large file (but this would be possible only if the file has been createdd by your same program :-)
ASKER
OK. I will try this afternoon. I don't really have another choice I think. Splitting the big file in parts, is not that easy. So I will try this afternoon.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Open in new window
Hope this helps :-)