网站首页  词典首页

请输入您要查询的函数:

 

术语 virtualfreeex
释义 VirtualFreeEx
语法:
C++
BOOL WINAPI VirtualFreeEx(
__in HANDLE hProcess,
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD dwFreeType
);
VirtualFreeEx函数
发布,可以收回,或发布和可以收回在一个特定进程的虚拟地址空间的内存区域。
参数
hProcess [in]
句柄的进程。函数内释放的进程的虚拟地址空间的内存。
句柄必须有PROCESS_VM_OPERATION访问权。有关更多信息,请参见过程的安全性和访问权限。
lpAddress [in]
是对内存区域的起始地址指针被释放。
如果dwFreeType参数MEM_RELEASE,lpAddress必须解决的基础,该区域时,保留VirtualAllocEx函数返回。
dwSize [in]
该内存区域的大小自由,以字节为单位。
如果dwFreeType参数MEM_RELEASE,dwSize必须是0(零)。函数释放整个地区是在初始分配调用VirtualAllocEx保留。
如果dwFreeType是MEM_DECOMMIT,功能可以收回所有内存页面中包含由lpAddress参数(lpAddress + dwSize的一个或多个字节)。这意味着,例如,一个2字节的内存区域,跨越边界造成的网页都被decommitted页。如果lpAddress是基址返回VirtualAllocEx和dwSize为0(零),函数可以收回整个地区由VirtualAllocEx分配。在此之后,整个地区是在保留状态。
dwFreeType [in]
自由运作的类型。此参数可以是下列值之一。
ValueMeaning
MEM_DECOMMIT
0x4000Decommits中所承诺的网页指定的区域。手术后,页面是在保留状态。
该函数不失败如果您尝试承诺解除未提交的网页。这意味着您可以不首先承诺解除目前的承诺,确定其状态的页面范围。
不要使用这个MEM_RELEASE价值。
MEM_RELEASE
0x8000Releases的页面指定区域。手术后,页面是在自由的状态。
如果指定此值,dwSize必须是0(零),lpAddress必须指出,基地址返回这一地区保留的VirtualAllocEx功能。函数如果这些条件的失败并不满足。
如果在该地区的任何页致力于目前,该函数的第一个可以收回,然后释放他们。
该函数不失败如果您尝试发布的网页在不同的州,一些保留,有些所犯的。这意味着,您可以释放目前没有确定承诺,国家的第一个1的页面范围。
不要使用这个MEM_DECOMMIT价值。
返回值
如果函数成功,返回值是一个非零值。
如果函数失败,返回值为0(零)。为了获得更多错误信息,调用GetLastError。
备注
记忆中的每一个进程的虚拟地址空间页有一页的状态。该VirtualFreeEx函数可以承诺解除的网页,在不同国家的范围,有些是和一些未提交的。这意味着您可以承诺解除首先确定在每一页当前承诺状态的页面范围。 Decommitting网页发布其物理存储,无论是在内存或磁盘上的分页文件。
如果一个页面decommitted,但没有公布,其状态更改为保留。随后,您可以调用VirtualAllocEx去犯罪,或VirtualFreeEx释放它。试图读取或写入到一个访问冲突异常保留网页的结果。
该VirtualFreeEx函数可以释放出的网页,在不同的国家,一些保留,有些所犯的范围。这意味着,您可以释放没有确定每一页当前第一位国家承诺的页面范围。在保留原来VirtualAllocEx整个系列的网页必须释放在同一时间。
如果一个网页被释放,其状态更改为免费的,它是为以后的行动提供拨款。内存被释放后或decommitted,您永远无法指内存了。任何可能在该内存是信息已经一去不复返了。尝试读取或写入到一个访问冲突异常免费网页结果。如果您需要保持的资料,不承诺解除或可用内存,其中包含的信息。
该VirtualFreeEx函数可用于博览馆的内存区域,它无效在该地区的任何物理页映射时释放的地址空间。然而,物理页面不会被删除,并且应用程序可以使用它们。应用程序必须显式调用FreeUserPhysicalPages释放物理页。当进程终止时,所有的资源会自动清除。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
内存管理功能
虚拟内存函数
VirtualAllocEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==VirtualFreeEx Function
Releases, decommits, or releases and decommits a region of memory within the virtual address space of a specified process.
Syntax
C++
BOOL WINAPI VirtualFreeEx(
__in HANDLE hProcess,
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD dwFreeType
);
Parameters
hProcess [in]
A handle to a process. The function frees memory within the virtual address space of the process.
The handle must have the PROCESS_VM_OPERATION access right. For more information, see Process Security and Access Rights .
lpAddress [in]
A pointer to the starting address of the region of memory to be freed.
If the dwFreeType parameter is MEM_RELEASE, lpAddress must be the base address returned by the VirtualAllocEx function when the region is reserved.
dwSize [in]
The size of the region of memory to free, in bytes.
If the dwFreeType parameter is MEM_RELEASE, dwSize must be 0 (zero). The function frees the entire region that is reserved in the initial allocation call to VirtualAllocEx.
If dwFreeType 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 VirtualAllocEx and dwSize is 0 (zero), the function decommits the entire region that is allocated by VirtualAllocEx. 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 their current commitment state.
Do not use this value with MEM_RELEASE.
MEM_RELEASE
0x8000Releases the specified region of pages. After the 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 VirtualAllocEx 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 a nonzero value.
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 VirtualFreeEx 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 VirtualAllocEx to commit it, or VirtualFreeEx to release it. Attempting to read from or write to a reserved page results in an access violation exception.
The VirtualFreeEx 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 VirtualAllocEx 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 decommitted, you can never refer to the memory again. Any information that may have been in that memory is gone forever. Attempts 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 VirtualFreeEx 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 pages are 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 automatically cleaned up.
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
VirtualAllocEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366894(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:32:21