mmap: will the mapped file be loaded into memory immediately?

后端 未结 4 1074
無奈伤痛
無奈伤痛 2020-12-30 06:12

From the manual, I just know that mmap() maps a file to a virtual address space, so the file can be randomly accessed. But, it is unclear to me that whether the mapped file

4条回答
  •  不思量自难忘°
    2020-12-30 06:30

    Yes. The whole point of mmap is that is manages memory more efficiently than just slurping everything into memory.

    Of course, any given implementation may in some situations decide that it's more efficient to read in the whole file in one go, but that should be transparent to the program calling mmap.

提交回复
热议问题