2011-01-19 19:25:00 UTC
I compiled the following piece of code with Visual Studio 9.0 to
determine type of heap CRT use at runtime. In WindowsXP, I get the
heap type as look-asides whereas in windows 7 I get regular heap.
Here are my questions:
Is regular heap same as low fragmentation heap? Please explain if
there is any difference between the two.
Starting from Vista, I know the heap allocator has changed to LFH by
default. Is this the reason why I see 'regular heap' in Windows 7?
If I compile this piece of code with Visual Studio 10.0, I get the
heap type as LFH in Windows 7. Does VS 2010 changed the heap allocator
model of CRT? So if I run VS 2010 compiled code in windows xp, will I
get the heap type as LFH?
If you open a cmd shell in windows 7 and run Visual studio 9.0
compiled code with HOME env set c:\users\, I see the heap type is
changed to LFH? Why is this difference?
ULONG HeapFragValue = 2;
ULONG heap_info = 0;
SIZE_T ret_size = 0;
crt_heap = (HANDLE) _get_heap_handle ();
if (HeapQueryInformation (crt_heap,
printf ("Heap %d is a regular heap.\n");
printf ("Heap %d is a heap with look-asides (fast heap).\n");
printf ("Heap %d is a LFH (low-fragmentation) heap.\n");
printf ("Heap %d is of unknown type.\n");