_get_heap_handle
返回 C 运行时系统使用的堆处理。
重要
此 API 不能用于在 Windows 运行时中执行的应用程序。除非调试时。有关详细信息,请参见 CRT functions not supported with /ZW(CRT 函数不支持使用/ZW)。
intptr_t _get_heap_handle( void );
返回值
将处理返回到 C 运行时系统使用的 Win32 堆。
备注
如果要调用 HeapSetInformation 和启用 CRT 堆上的低碎片堆请使用此函数。
要求
例程 |
必需的标头 |
---|---|
_get_heap_handle |
<malloc.h> |
有关兼容性的更多信息,请参见兼容性。
示例
// crt_get_heap_handle.cpp
// compile with: /MT
#include <windows.h>
#include <malloc.h>
#include <stdio.h>
int main(void)
{
intptr_t hCrtHeap = _get_heap_handle();
ULONG ulEnableLFH = 2;
if (HeapSetInformation((PVOID)hCrtHeap,
HeapCompatibilityInformation,
&ulEnableLFH, sizeof(ulEnableLFH)))
puts("Enabling Low Fragmentation Heap succeeded");
else
puts("Enabling Low Fragmentation Heap failed");
return 0;
}