Memory limitations for processes are based on virtual memory,
not physical memory (RAM).
The max memory available for a given process depends on whether
it is x86 or x64, which version of WIndows the process is running
under, whether or not the program was built with
IMAGE_FILE_LARGE_ADDRESS_AWARE
set or cleared, etc.
See:
Memory Limits for Windows and Windows Server Releases
https://learn.microsoft.com/en-us/windows/win32/memory/memory-limits-for-windows-releases
Within these constraints, the max size that a dynamic allocated array
can have depends on how much of the process's memory space is available considering all other demands on that space. Code, other dynamic allocations, etc. all deplete the available heap.
Note that allocating all of the available heap via new[], malloc,
etc. can result in other parts of the program failing later when
an attempt is made to acquire space from the heap. This may occur
within library code such as expanding class objects such as
vectors, lists, maps, strings, etc.
- Wayne