用户空间内存和物理内存映射
How to make mmap() a large range of memory which is larger than the total size of physical memory and swap successfully?
如何使mmap()的内存范围大于物理内存的总大小并成功交换?
Short answer:
简短答案:
Adding the MAP_NORESERVE flag to mmap() to make it not reserve any swap space for the mapping.
在mmap()中添加MAP_NORESERVE标志,以使其不为映射保留任何交换空间 。
For example:
例如:
rr_addr = mmap((void*)i, len, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
More details in: http://stackoverflow.com/questions/4803152/mmap-fails-when-length-is-larger-than-4gb
有关更多详细信息,请参见: http : //stackoverflow.com/questions/4803152/mmap-fails-when-length-is-larger-than-4gb
Answered by SA.
由SA回答。
用户空间内存和物理内存映射