_get_heap_handle

Restituisce l'handle dell'heap che viene usato dal sistema di runtime del linguaggio C.

Sintassi

intptr_t _get_heap_handle( void );

Valore restituito

Restituisce l'handle dell'heap Win32 che viene usato dal sistema di runtime del linguaggio C.

Osservazioni:

Usare questa funzione se si vuole chiamare HeapSetInformation e abilitare l'heap a frammentazione bassa nell'heap CRT.

Per impostazione predefinita, lo stato globale di questa funzione è limitato all'applicazione. Per modificare questo comportamento, vedere Stato globale in CRT.

Requisiti

Ciclo Intestazione obbligatoria
_get_heap_handle <malloc.h>

Per altre informazioni sulla compatibilità, vedere Compatibility (Compatibilità).

Esempio

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

Vedi anche

Allocazione di memoria