Committing Storage in a Reserved Region

After you have reserved a region, you need to commit physical storage to the region before you can access the memory addresses contained within it. The system allocates physical storage committed to a region from the system’s paging file. Physical storage is always committed on page boundaries and in page-size chunks.

To commit physical storage, you must call VirtualAlloc again. This time, however, you’ll pass the MEM_COMMIT identifier instead of the MEM_RESERVE identifier for the fdwAllocationType parameter. You usually pass the same page protection attribute (most often PAGE_READWRITE) that was used when VirtualAlloc was called to reserve the region, although you can specify a different protection attribute. ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.