I've wrote a test application which creates numerous heaps via HeapAlloc. However, when I attach and run the !heap command in WinDbg I only see a single (presumably default) heap.
If i force NT / Segment heap on the process this is correctly reflected in !heap, but I only ever see one entry.
Sorry, it's been a long day. I mistyped my original post. I should have typed: I've wrote a test application which creates numerous heaps via **HeapCreate**.
I would have thought 1x HeapCreate = 1 more visible heap in !heap?
yes 1 HeapCreate() should show 1 more Heap entry in !heap command
#include <windows.h>
#include <stdio.h>
#define MyHeapNum 0x80
int main (void)
{
HANDLE MyHeaps[MyHeapNum] = {0};
for (int i =0; i<MyHeapNum; i++ )
{
MyHeaps[i] = HeapCreate(0,0,0);
printf("%p\n" , MyHeaps[i]);
}
}
toss the compiled exe into cdb
disassemble main and locate the address after the HeapCreate Call
set a breakpoint on the address and check the default heaps before continuing
continue with g;!heap each continuation should yield one extra entry
0:000> g;!heap
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
241065b0000 NT Heap
24106920000 NT Heap
0:000> g;!heap
0000024106920000
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
241065b0000 NT Heap
24106920000 NT Heap
24106a50000 NT Heap
0:000> g;!heap
0000024106A50000
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
241065b0000 NT Heap
24106920000 NT Heap
24106a50000 NT Heap
24106c50000 NT Heap
0:000> g;!heap
0000024106C50000
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
241065b0000 NT Heap
24106920000 NT Heap
24106a50000 NT Heap
24106c50000 NT Heap
24106c20000 NT Heap
0:000> g;!heap
0000024106C20000
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
241065b0000 NT Heap
24106920000 NT Heap
24106a50000 NT Heap
24106c50000 NT Heap
24106c20000 NT Heap
241068c0000 NT Heap
0:000>
executing 0n127 times
0:000> g;!heap;dv
0000024106B50000 <<<<<<<<<<<<<<<<<
Breakpoint 0 hit
Heap Address NT/Segment Heap
24106630000 NT Heap
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
24108000000 NT Heap
i = 0n127
MyHeaps = void *[128]
0:000> dt -a MyHeaps
Local var @ 0xe649f5f700 Type void*[]
[0] @ 000000e6`49f5f700
---------------------------------------------
0x00000241`06920000
Void
xxxxxxxxxxxxxxxxxxxxxxxxx
[126] @ 000000e6`49f5faf0 <<<<<<<<<<<<<<<<<
---------------------------------------------
0x00000241`06b50000 <<<<<<<<<<<<<<<<<<<<<<
Void
[127] @ 000000e6`49f5faf8
---------------------------------------------
(null)