网站首页  词典首页

请输入您要查询的函数:

 

术语 virtualfree
释义 VirtualFree
语法:
C++
BOOL WINAPI VirtualFree(
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD dwFreeType
);
VirtualFree函数
发布,可以收回,或发布和可以收回在调用进程的虚拟地址空间区域的网页。
要释放内存在另一个进程中分配给VirtualAllocEx功能,使用VirtualFreeEx函数。
参数
lpAddress [in]
是对地区的页面基址指针被释放。
如果dwFreeType参数MEM_RELEASE,此参数必须是基处理网页时,保留区域VirtualAlloc函数返回。
dwSize [in]
该区域的大小的内存被释放,以字节为单位。
如果dwFreeType参数MEM_RELEASE,此参数必须是0(零)。函数释放整个地区是在初始分配调用VirtualAlloc保留。
如果dwFreeType参数MEM_DECOMMIT,功能可以收回所有内存页面中包含由lpAddress参数(lpAddress + dwSize的一个或多个字节)。这意味着,例如,一个2字节的内存区域,跨越边界造成的网页都被decommitted页。如果lpAddress是基址返回VirtualAlloc和dwSize为0(零),函数可以收回整个地区由VirtualAlloc分配。在此之后,整个地区是在保留状态。
dwFreeType [in]
自由运作的类型。此参数可以是下列值之一。
ValueMeaning
MEM_DECOMMIT
0x4000Decommits中所承诺的网页指定的区域。手术后,页面是在保留状态。
该函数不失败如果您尝试承诺解除未提交的网页。这意味着您可以承诺解除首先确定当前承诺状态的页面范围。
不要使用这个MEM_RELEASE价值。
MEM_RELEASE
0x8000Releases的页面指定区域。此操作后,页面是在自由的状态。
如果指定此值,dwSize必须是0(零),lpAddress必须指出,基地址返回这一地区保留的VirtualAlloc函数。函数如果这些条件的失败并不满足。
如果在该地区的任何页致力于目前,该函数的第一个可以收回,然后释放他们。
该函数不失败如果您尝试发布的网页在不同的州,一些保留,有些所犯的。这意味着,您可以释放目前没有确定承诺,国家的第一个1的页面范围。
不要使用这个MEM_DECOMMIT价值。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值为0(零)。为了获得更多错误信息,调用GetLastError。
备注
记忆中的每一个进程的虚拟地址空间页有一页的状态。 VirtualFree函数可以承诺解除的网页,在不同国家的范围,有些是和一些未提交的。这意味着您可以承诺解除首先确定在每一页当前承诺状态的页面范围。 Decommitting网页发布其物理存储,无论是在内存或磁盘上的分页文件。
如果一个页面decommitted,但没有公布,其状态更改为保留。随后,您可以调用VirtualAlloc去犯罪,或VirtualFree释放它。尝试读取或写入到一个访问冲突异常保留网页的结果。
VirtualFree函数释放出的网页在不同的州,一些保留,有些所犯的范围。这意味着,您可以释放没有确定每一页当前第一位国家承诺的页面范围。在整个范围的页面原来由VirtualAlloc函数必须释放保留在同一时间。
如果一个网页被释放,其状态更改为免费的,它是为以后的行动提供拨款。内存被释放后或decommited,您永远无法指内存了。任何可能在该内存是信息已经一去不复返了。试图读取或写入到一个访问冲突异常免费网页结果。如果您需要保持的资料,不承诺解除或可用内存,其中包含的信息。
VirtualFree函数可用于博览馆的内存区域,它无效在该地区的任何物理页映射时释放的地址空间。然而,物理页面不会被删除,并且应用程序可以使用它们。应用程序必须显式调用FreeUserPhysicalPages释放物理页。当进程终止时,所有的资源自动清除。
实例
有关示例,请参见保留国和提交内存。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
内存管理功能
虚拟内存函数
VirtualFreeEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==VirtualFree Function
Releases, decommits, or releases and decommits a region of pages within the virtual address space of the calling process.
To free memory allocated in another process by the VirtualAllocEx function, use the VirtualFreeEx function.
Syntax
C++
BOOL WINAPI VirtualFree(
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD dwFreeType
);
Parameters
lpAddress [in]
A pointer to the base address of the region of pages to be freed.
If the dwFreeType parameter is MEM_RELEASE, this parameter must be the base address returned by the VirtualAlloc function when the region of pages is reserved.
dwSize [in]
The size of the region of memory to be freed, in bytes.
If the dwFreeType parameter is MEM_RELEASE, this parameter must be 0 (zero). The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc.
If the dwFreeType parameter is MEM_DECOMMIT, the function decommits all memory pages that contain one or more bytes in the range from the lpAddress parameter to (lpAddress+dwSize). This means, for example, that a 2-byte region of memory that straddles a page boundary causes both pages to be decommitted. If lpAddress is the base address returned by VirtualAlloc and dwSize is 0 (zero), the function decommits the entire region that is allocated by VirtualAlloc. After that, the entire region is in the reserved state.
dwFreeType [in]
The type of free operation. This parameter can be one of the following values.
ValueMeaning
MEM_DECOMMIT
0x4000Decommits the specified region of committed pages. After the operation, the pages are in the reserved state.
The function does not fail if you attempt to decommit an uncommitted page. This means that you can decommit a range of pages without first determining the current commitment state.
Do not use this value with MEM_RELEASE.
MEM_RELEASE
0x8000Releases the specified region of pages. After this operation, the pages are in the free state.
If you specify this value, dwSize must be 0 (zero), and lpAddress must point to the base address returned by the VirtualAlloc function when the region is reserved. The function fails if either of these conditions is not met.
If any pages in the region are committed currently, the function first decommits, and then releases them.
The function does not fail if you attempt to release pages that are in different states, some reserved and some committed. This means that you can release a range of pages without first determining the current commitment state.
Do not use this value with MEM_DECOMMIT.

Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError .
Remarks
Each page of memory in a process virtual address space has a Page State . The VirtualFree function can decommit a range of pages that are in different states, some committed and some uncommitted. This means that you can decommit a range of pages without first determining the current commitment state of each page. 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. Subsequently, you can call VirtualAlloc to commit it, or VirtualFree to release it. Attempts to read from or write to a reserved page results in an access violation exception.
The VirtualFree function can release a range of pages that are in different states, some reserved and some committed. This means that you can release a range of pages without first determining the current commitment state of each page. The entire range of pages originally reserved by the VirtualAlloc function must be released at the same time.
If a page is released, its state changes to free, and it is available for subsequent allocation operations. After memory is released or decommited, you can never refer to the memory again. Any information that may have been in that memory is gone forever. Attempting to read from or write to a free page results in an access violation exception. If you need to keep information, do not decommit or free memory that contains the information.
The VirtualFree function can be used on an AWE region of memory, and it invalidates any physical page mappings in the region when freeing the address space. However, the physical page is not deleted, and the application can use them. The application must explicitly call FreeUserPhysicalPages to free the physical pages. When the process is terminated, all resources are cleaned up automatically.
Examples
For an example, see Reserving and Committing Memory .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Memory Management Functions
Virtual Memory Functions
VirtualFreeEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:28:45