8

How can I reserve virtual memory in Linux?

view full story
linux-howto

http://stackoverflow.com – I have an application that reserves a contiguous memory block using VirtualAllocEx on Windows with the MEM_RESERVE flag. This reserves a virtual memory block, but does not back it with a physical page or page file chunk. Hence, accessing the allocated memory will result in a segmentation fault -- but other allocations will not intersect with this virtual memory block. How can I do the same for Linux with mmap? I did notice the answer in this question, but does that really guarantee that say, 1 GB of physical memory won't be allocated to my process if I don't touch the allocated pages? I d (HowTos)