What are the downsides of using VirtualAlloc for arrays, reserving large chunk of address space, and committing pages when they are needed? For example if I know max cap for my array, I can reserve address space for it, using VirtualAlloc, and commit memory if I actually need it.
Unlike std::vector in this case, all pointers will remain valid after adding need pages to array.
I understand that this is not suitable for all arrays in program, but in the case when I need to save a pointers after array grows/resize?
Or should I just use std::deque? But with std::deque I gonna lose continues address space.