Opening very large textfiles. -> Asigning more memory...
If I open a file wich is larger than approx. 2MB my program crashes, it doesn't respond anymore.
I think it has to do with memory assignment.
If it is the case of memory. How can I expand it?
Anyway...
How can I open very large (approx 50MB) textfiles in VB?
Any help would be appreciated.
Thanks...
Re: Opening very large textfiles. -> Asigning more memory...
There are not many restrictions on processing large files. Two might be physical and virtual memory size related to Windows processing instead of VB.
You might be a little more explicit about how you are processig this file. Opening a file does very little. Reading records does a lot more. Are you trying to read the entire file into memory at onec? If yes how are you attempting to do this?
What kind of error are you getting? Error Message? Simple hang? VB crash? system crash? Hard loop?
John G
Re: Opening very large textfiles. -> Asigning more memory...
The reason your program hangs is probably because you are reading the file as a string. As you might know, strings are slow, very slow. Also, the function you use to read the file can make a big difference. Using Get will increase performance a lot, this function is much much much better than Input(), or Line Input. also, if possible, use a byte array to do the reading, which is faster than string. Of course, this might be a bit hard to process if you actually need to compare two values.
I had a similar problem a few days ago, I used Input and strings, which took me 40 seconds to read a 4 MB file into memory. When using Get and a byte array, it took me 200 ms to read the entire file.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook