|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| Yes
| Import Library
| kernel32.lib
| Header File
| winbase.h
| Unicode
| No
| Platform Notes
| None
|
|
|
VirtualFree
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
| );
|
|
Parameters
lpAddress
Points to the base address of the region of pages to be freed. If the dwFreeType parameter includes the MEM_RELEASE flag, this parameter must be the base
address returned by the VirtualAlloc function when the region of pages was reserved.
dwSize
Specifies the size, in bytes, of the region to be freed. If the dwFreeType parameter includes the MEM_RELEASE flag, this parameter must be zero.
Otherwise, the region of affected pages includes all pages containing one or more
bytes in the range from the lpAddress parameter to (lpAddress+dwSize). This means that a 2-byte range straddling a page boundary causes both pages
to be freed.
dwFreeType
Specifies the type of free operation. One, but not both, of the following
flags can be specified:
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.
|
Return Values
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.
Remarks
VirtualFree can perform one of the following operations:
- Decommit a region of committed or uncommitted pages.
- Release a region of reserved pages.
- Decommit and release a region of committed or uncommitted pages.
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.
See Also
GlobalAlloc, GlobalFree, VirtualAlloc
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|