Any way to reserve but not commit memory in linux?

前端 未结 4 1232
南方客
南方客 2020-12-01 03:00

Windows has VirtualAlloc, which allows you to reserve a contiguous region of address space, but not actually use any physical memory. Later when you want to use it (or part

4条回答
  •  情书的邮戳
    2020-12-01 03:41

    mmap a special file, like /dev/zero (or use MAP_ANONYMOUS) as PROT_NONE, later use mprotect to commit.

提交回复
热议问题