Does mmap really copy data to the memory?

前端 未结 4 1732
臣服心动
臣服心动 2021-01-31 23:34

It is said that mmap() maps files to the memory, and it costs to the virtual address space memory of the calling process. Does it really copy data to the memory, or

4条回答
  •  醉话见心
    2021-02-01 00:11

    Copying does not imply that the original is destroyed.

    It maps the contents of the disk into memory, so of course at some point the bits must be copied, yes.

    And since this means it needs address space, that occupies part of the process' virtual address space.

提交回复
热议问题