Does mmap with MAP_NORESERVE reserve physical memory?

后端 未结 3 544
情书的邮戳
情书的邮戳 2020-12-03 15:29

The mmap documentation says following about the flag MAP_NORESERVE.

Do not reserve swap space for this mapping. When swap space is reserved, one ha

3条回答
  •  长情又很酷
    2020-12-03 15:55

    On linux mmap sets up virtual memory mappings only, whether you use MAP_NORESERVE or not, no physical memory is assigned until you touch the memory.

    MAP_FIXED is unrelated to this, it sets up the virtual memory mappings at the virtual(not physical) address you specify, or fails if there's no room for the mapping at that address.

提交回复
热议问题