SizeOfHeapReserve and SizeOfHeapCommit are in the optional header of windows executables. They are set to 0x100000 and 0x1000 respectively in most executables (my firefox has 0x40000 as reserve for example). The docs just say it is "The size of the local heap space to reserve/commit".

  • How do executables ever get a pointer to this reserved heap space? I thought they always needed to call HeapAlloc / VirtualAlloc to get heap space?
  • How do linkers decide what to set these values to?

1 Answer 1


Size Of Heap by Default is 1MB Reserve and 1KB commit

these can be changed by using linker option /HEAP:<reserve>,commit

During Initialization of Process system/loader/os Creates a Process Heap for Each Process

Changing the SizeOfHeapCommit and Reserve Changes the Size of this ProcessHeap

the Address Heap Thus Allocated During Process Creation is Available to the Process in Process Environment Block or peb

0:000> dt ntdll!_PEB @$peb -y ProcessH

   +0x018 ProcessHeap : 0x004e0000 Void
   +0x090 ProcessHeaps : 0x76fb7500  -> 0x004e0000 Void

0:000> !heap -stat 4e0000
_HEAP 004e0000
     Segments            00000001
         Reserved  bytes 00a00000  <<<<<<
         Committed bytes 00a00000  <<<<<<
                           exe was compiled with /link /HEAP:10485760,10485760
     VirtAllocBlocks     00000000
         VirtAlloc bytes 00000000
_HEAP 00020000
     Segments            00000001
         Reserved  bytes 00010000
         Committed bytes 00001000
     VirtAllocBlocks     00000000
         VirtAlloc bytes 00000000

0:000> .shell -ci "!dh ten" grep -i "size of heap"

00a00000 size of heap reserve
00a00000 size of heap commit
.shell: Process exited

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.