Reading 4 GB file using 2 GB physical memory [modified]
-
hi guys, i came up with a problem. I have 4 GB file(disk size) and i want to read this file in my 2 GB(primary memory) machine. Please suggest the best method to do so?
Величие не Бога может быть недооценена.
modified on Tuesday, December 21, 2010 2:57 AM
-
hi guys, i came up with a problem. I have 4 GB file(disk size) and i want to read this file in my 2 GB(primary memory) machine. Please suggest the best method to do so?
Величие не Бога может быть недооценена.
modified on Tuesday, December 21, 2010 2:57 AM
You can always read data in chunks. Do you mean how to load the entire 4GB into RAM?
...byte till it megahertz... my donation to web rubbish
-
You can always read data in chunks. Do you mean how to load the entire 4GB into RAM?
...byte till it megahertz... my donation to web rubbish
Not exactly, i want to find some data in that file. So need to until that point is enough, but that search may be on last part. So i need a mechanism to do so. I believe CreateFileMapping can be used, do u think, its a good solution?
Величие не Бога может быть недооценена.
-
Not exactly, i want to find some data in that file. So need to until that point is enough, but that search may be on last part. So i need a mechanism to do so. I believe CreateFileMapping can be used, do u think, its a good solution?
Величие не Бога может быть недооценена.
So you indeed need to read data in chunks as I said. Load a chunk and perform the search. Keep loading the next part of the file into the chunk until you get the data. To do this, you may use memory mapped file or one of the various
read(...)
functions (Win32 API, CRT etc). Either way, you would still have to read the file in chunks....byte till it megahertz... my donation to web rubbish