Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

_get_heap_handle

Returns the handle of the heap used by the C run-time system.

intptr_t _get_heap_handle( void );

Return Value

Returns the HANDLE to the Win32 heap used by the C run-time system.

Remarks

Use this function if you want to call HeapSetInformation and enable the Low Fragmentation Heap on the CRT heap.

Requirements

Routine Required header Compatibility
_get_heap_handle <malloc.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Sample

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

See Also

Memory Allocation | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.