For my projects, I always do arena allocation in two steps:
- Reserve virtual address space for the maximum size of the arena.
- Allocate from the arena as a bump allocator until the uncommitted part is hit, in which case we need to commit the next block.
On HMH, Casey talks about something special happening on x64, whereby he can just commit after a committed chunk, and expect it to succeed as long as memory is available, growing an arena contiguously without reserving anything.
My question is whether there is some sort of OS support for this, or whether he is just counting on the address space being big enough that there will be a lot of unused contiguous virtual memory.
Does x64 support moving pages out of the way or something? I'm not seeing a robust way for this to work w/o running VirtualQuery. What am I missing? MSDN links would be appreciated.