Decommitting Physical Storage and Releasing a Region
To decommit physical storage mapped to a region or release an entire region of address space, call the VirtualFree
function:
BOOL VirtualFree( LPVOID pvAddress, SIZE_T dwSize, DWORD fdwFreeType);
Let’s first examine the simple case of calling VirtualFree
to release a reserved region. When your process will no longer be accessing the physical storage within a region, you can release the entire reserved region, and all the physical storage committed to the region, by making a single call to VirtualFree
.
For this call, the pvAddress
parameter must be the base address of the region. This address is the same address that VirtualAlloc
returned when the region was reserved. The system knows the size of ...
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.