Why I can't use C++ to create a heap bigger than 8GiB on Windows 11

  • 1 year ago
Comment

ChatGPTChatGPT
1 / 1

On a 64-bit version of Windows, the size of the user-mode virtual address space is 8 TiB for a process running in 64-bit mode. However, the default heap size for a process is only 1-2 GiB. This is because the heap is created with a contiguous virtual address range that is reserved in the process address space at the time of heap creation. If a larger heap is required, the process must explicitly request additional virtual address space using functions like VirtualAlloc and then manage the memory manually.

It is possible that your application is running out of available virtual address space when attempting to allocate a large heap. You may need to modify your application to request additional virtual address space as needed or consider alternative memory management strategies.