Does mmap with MAP_NORESERVE reserve physical memory?

后端 未结 3 547
情书的邮戳
情书的邮戳 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 16:11

    Just use a normal mmap(). Any modern enough OS (ie, past, what, 1995?) which implements mmap also implements demand paging, and pages will only be reserved if you actually write to them.

提交回复
热议问题