Page Allocation

The VMM provides a set of page allocation services that do not separately reserve and commit pages. Internally, these services simply reserve and commit pages in one step by calling the appropriate sparse memory management services.

To allocate pages, use the _PageAllocate service. The service allocates (reserves and commits) a memory block, and returns the block's base linear address. The address is identical to the address returned by the _PageReserve service. To free the memory block, pass the linear address by using the _PageFree service.

You can change the size of a memory block after it is allocated by using the _PageReAllocate service. The service attempts to change the committed size of the object without changing its base address. However, if necessary the service reserves a new memory block and copies the existing pages to it.

To determine the size of a memory block, use the _PageGetSizeAddr service. This service returns the reserved size of the block, which may be greater than the number of committed pages in the memory block. You can get information about the amount of available memory by using the _PageGetAllocInfo and _GetFreePageCount services.

Because these services use the sparse memory management services internally, it is possible to use the two groups of services in combination. For example, you might allocate a memory block using _PageAllocate and then decommit certain pages in that memory block using the _PageDecommit service. However, combining these services is generally not recommended because doing so might break assumptions made by the page allocation services. For example, the _PageReAllocate service assumes that all committed pages in a memory block are contiguous, which may not be the case if sparse memory allocation services have been used on the same region.

See Also

_PageGetAllocInfo, _GetFreePageCount, _PageGetSizeAddr, _PageReAllocate, _PageReserve, _PageFree