The VirtualFree function releases or decommits (or both) a region of pages within the virtual address space of the calling process.
BOOL VirtualFree(
LPVOID lpAddress, |
// address of region of committed pages |
DWORD dwSize, |
// size of region |
DWORD dwFreeType |
// type of free operation |
); |
Flag |
Meaning |
MEM_DECOMMIT |
Decommits the specified region of committed pages. |
An attempt to decommit an uncommitted page will not cause the function to fail. This means that a range of committed or uncommitted pages can be decommitted without having to worry about a failure. | |
MEM_RELEASE |
Releases the specified region of reserved pages. If this flag is specified, the dwSize parameter must be zero, or the function fails. |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
VirtualFree can perform one of the following operations:
To release a region of pages, the entire range of pages must be in the same state (all reserved or all committed) and the entire region originally reserved by the VirtualAlloc function must be released at the same time. If only part of the pages in the original reserved region are committed, you must first call VirtualFree to decommit the committed pages and then call VirtualFree again to release the entire block.
Pages that have been released are free pages available for subsequent allocation operations. Attempting to read from or write to a free page results in an access violation exception.
VirtualFree can decommit an uncommitted page; this means that a range of committed or uncommitted pages can be decommitted without having to worry about a failure. Decommitting a page releases its physical storage, either in memory or in the paging file on disk. If a page is decommitted but not released, its state changes to reserved, and it can be committed again by a subsequent call to VirtualAlloc. Attempting to read from or write to a reserved page results in an access violation exception.
The current state of the entire range of pages must be compatible with the type of free operation specified by the dwFreeType parameter. Otherwise, the function fails and no pages are released or decommitted.
GlobalAlloc, GlobalFree, VirtualAlloc
file: /Techref/os/win/api/win32/func/src/f90_10.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/15 17:20,
3.144.84.61:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/os/win/api/win32/func/src/f90_10.htm"> VirtualFree</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.