(1) I'm not sure the question matches the name. If you place about 2 GB of RAM on 32-bit Windows, the system will probably map a lot of memory to disk and that I will first look for slowdowns. When you use a lot of memory, you should think of it as storage on disk (in the pagefile.sys file) but cached in physical memory. The second one may be faster not because of the cost of allocation, but because of the cost of using a large amount of memory at the same time. In fact, when you copy a file to one large selection, you copy most of the disk disk-> disk through RAM, and then when you run it again for analysis, you load the copy back into RAM. If your analysis is a one-pass algorithm in which there is a lot of redundant work.
(2) I think the mmap file (MapViewOfFile and friends on Windows).
Edit: (3) caution. If this file is currently 1.8 GB, it might be 4 GB next year. If so, I plan now to have a size larger than 2 ^ 32 on a 32-bit machine, which means either accepting the second option, or still using MapViewOfFile, but not executing it at one reasonable file size. Otherwise, you will review this code the first time you run it in a large file and report an error.
Steve jessop
source share