Hacker News new | ask | show | jobs
by 9029 529 days ago
Another (admittedly less portable) way to solve the resizing problem is to reserve a large virtual memory space using linux mmap with the PROT_NONE flag and then commit pages as needed using mprotect with PROT_READ|PROT_WRITE flags. I believe windows' VirtualAlloc/VirtualProtect also allows this
1 comments

You don't need to do anything with the flags. You can just mmap a huge virtual area and the pages will be realized whenever you first touch them.
Today I learned, thanks