I am writing a program that receives huge amounts of data (in pieces of different sizes) from the network, processes them and writes them to memory. Since some pieces of data ca
The main advantage of mmap with big files is to share the same memory mapping between two or more file: if you mmap with MAP_SHARED
, it will be loaded into memory only once for all the processes that will use the data with the memory saving.
But AFAIK , mmap maps the entire file into memory (Here you can find examples of how mmap fails with files bigger than physical mem + swap space.) so if you access the file from a single process, it will not help you with the physical memory consumption.