网站首页  词典首页

请输入您要查询的函数:

 

术语 heapvalidate
释义 HeapValidate
语法:
C++
BOOL WINAPI HeapValidate(
__in HANDLE hHeap,
__in DWORD dwFlags,
__in_opt LPCVOID lpMem
);
HeapValidate功能
验证指定的堆。函数扫描所有堆中的内存块,并验证堆控制堆管理结构,保持一致的状态。您还可以使用HeapValidate功能验证指定的堆内,而不检查整个堆的有效性一个内存块。
参数
hHeap [in]
一个句柄,堆得到确认。这是处理无论是HeapCreate或GetProcessHeap函数返回。
dwFlags [in]
堆访问选项。此参数可以是以下值。
ValueMeaning
HEAP_NO_SERIALIZE
0x00000001Serialized访问将不会被使用。有关更多信息,请参见备注。
为了确保序列化的访问被禁用所有这个函数调用,指定在调用HEAP_NO_SERIALIZE的HeapCreate。在这种情况下,没有必要的补充规定,在此函数调用HEAP_NO_SERIALIZE。
This value should not be specified when accessing the process default heap.该系统可在应用中创建的过程中,如按Ctrl + C处理,能够同时访问该进程默认堆额外的线程。
lpMem [中,可选]
阿在指定的堆指针内存块。此参数可以为null。
如果该参数为NULL,则函数试图验证整个堆的hHeap指定。
如果此参数不是NULL,函数试图验证内存块指向lpMem。它不试图验证堆的休息。
返回值
如果指定的堆内存块,或者是有效的,则返回值为非零。
如果指定的堆内存块或无效,则返回值为0。在为调试了系统,HeapValidate功能,然后显示调试信息的描述堆或内存块是无效的一部分,停在一个硬编码的断点,以便您可以检查系统,以确定源无效。该HeapValidate函数不设置线程的最后一个错误的价值。没有此功能扩展的错误信息,不要调用GetLastError函数。
备注
该HeapValidate功能主要是对调试有用,因为验证是潜在的耗时。验证堆可以阻止访问堆其他线程,可降解,特别是在对称多处理性能,(SMP)计算机。这些副作用可以持续到HeapValidate回报。
有每个堆内存块堆控制结构,以及整个堆。当您使用HeapValidate函数来验证一个完整的堆,它检查的一致性所有这些控制结构。
当您使用HeapValidate验证堆在一个单一的内存块,而只是进行检查的控制结构有关的元素。 HeapValidate只能验证分配的内存块。上调用释放的内存块HeapValidate将返回FALSE,因为没有控制结构来验证。
If you want to validate the heap elements enumerated by the HeapWalk function, you should only call HeapValidate on the elements that have PROCESS_HEAP_ENTRY_BUSY in the wFlags member of the PROCESS_HEAP_ENTRY structure. HeapValidate返回FALSE所有堆元素没有此位集。
序列化,确保相互排斥的两个或多个线程试图同时分配或来自同一堆空闲块。有一个小的性能成本的序列化,但必须使用多线程分配时,从同一个堆的可用内存。设置HEAP_NO_SERIALIZE价值消除了堆相互排斥。没有系列化,两个或多个线程使用同一个堆句柄可能试图分配或释放内存同时,在堆可能滋生腐败。该HEAP_NO_SERIALIZE值,因此,可以放心使用只有在下列情况下:
这个过程只有一个线程。
这一进程的多个线程,但只有一个线程调用特定堆的堆函数。
这一进程的多个线程,并且应用程序提供了相互排斥的机制,以一个特定的堆。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
堆函数
HeapCreate
HeapWalk
内存管理功能
PROCESS_HEAP_ENTRY
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==HeapValidate Function
Validates the specified heap. The function scans all the memory blocks in the heap and verifies that the heap control structures maintained by the heap manager are in a consistent state. You can also use the HeapValidate function to validate a single memory block within a specified heap without checking the validity of the entire heap.
Syntax
C++
BOOL WINAPI HeapValidate(
__in HANDLE hHeap,
__in DWORD dwFlags,
__in_opt LPCVOID lpMem
);
Parameters
hHeap [in]
A handle to the heap to be validated. This handle is returned by either the HeapCreate or GetProcessHeap function.
dwFlags [in]
The heap access options. This parameter can be the following value.
ValueMeaning
HEAP_NO_SERIALIZE
0x00000001Serialized access will not be used. For more information, see Remarks.
To ensure that serialized access is disabled for all calls to this function, specify HEAP_NO_SERIALIZE in the call to HeapCreate. In this case, it is not necessary to additionally specify HEAP_NO_SERIALIZE in this function call.
This value should not be specified when accessing the process default heap. The system may create additional threads within the application's process, such as a CTRL+C handler, that simultaneously access the process default heap.

lpMem [in, optional]
A pointer to a memory block within the specified heap. This parameter may be NULL.
If this parameter is NULL, the function attempts to validate the entire heap specified by hHeap.
If this parameter is not NULL, the function attempts to validate the memory block pointed to by lpMem. It does not attempt to validate the rest of the heap.
Return Value
If the specified heap or memory block is valid, the return value is nonzero.
If the specified heap or memory block is invalid, the return value is zero. On a system set up for debugging, the HeapValidate function then displays debugging messages that describe the part of the heap or memory block that is invalid, and stops at a hard-coded breakpoint so that you can examine the system to determine the source of the invalidity. The HeapValidate function does not set the thread's last error value. There is no extended error information for this function; do not call GetLastError .
Remarks
The HeapValidate function is primarily useful for debugging because validation is potentially time-consuming. Validating a heap can block other threads from accessing the heap and can degrade performance, especially on symmetric multiprocessing (SMP) computers. These side effects can last until HeapValidate returns.
There are heap control structures for each memory block in a heap, and for the heap as a whole. When you use the HeapValidate function to validate a complete heap, it checks all of these control structures for consistency.
When you use HeapValidate to validate a single memory block within a heap, it checks only the control structures pertaining to that element. HeapValidate can only validate allocated memory blocks. Calling HeapValidate on a freed memory block will return FALSE because there are no control structures to validate.
If you want to validate the heap elements enumerated by the HeapWalk function, you should only call HeapValidate on the elements that have PROCESS_HEAP_ENTRY_BUSY in the wFlags member of the PROCESS_HEAP_ENTRY structure. HeapValidate returns FALSE for all heap elements that do not have this bit set.
Serialization ensures mutual exclusion when two or more threads attempt to simultaneously allocate or free blocks from the same heap. There is a small performance cost to serialization, but it must be used whenever multiple threads allocate and free memory from the same heap. Setting the HEAP_NO_SERIALIZE value eliminates mutual exclusion on the heap. Without serialization, two or more threads that use the same heap handle might attempt to allocate or free memory simultaneously, likely causing corruption in the heap. The HEAP_NO_SERIALIZE value can, therefore, be safely used only in the following situations:
The process has only one thread.
The process has multiple threads, but only one thread calls the heap functions for a specific heap.
The process has multiple threads, and the application provides its own mechanism for mutual exclusion to a specific heap.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Heap Functions
HeapCreate
HeapWalk
Memory Management Functions
PROCESS_HEAP_ENTRY
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366708(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 13:25:26