Date: 2010apr30
OS: Windows
Q. How do I enable the Low Fragmentation Heap (LFH) policy for the main heap?
A. Use _get_heap_handle() to get the heap handle then call HeapSetInformation().
You could use this to turn off the LFN if it doesn't suit your application.
Here's an example from MSDN:
// 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;
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment