_get_heap_handle

傳回 C 執行階段系統使用的堆積的控制代碼。

重要事項重要事項

這個應用程式開發介面無法在 Windows 執行階段執行的應用程式,但在偵錯組建。如需詳細資訊,請參閱 CRT 函式不支援使用 /ZW

intptr_t _get_heap_handle( void );

傳回值

將控制代碼傳回至 C 執行階段系統使用的 Win32 堆積。

備註

使用這個函式要呼叫 HeapSetInformation 和啟用 CRT 堆積的低分散堆積。

需求

程序

必要的標頭檔

_get_heap_handle

<malloc.h>

如需更多關於相容性的資訊,請參閱入門介紹中的 相容性 (Compatibility)

範例

// 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;
}

請參閱

參考

記憶體配置