You are going about it all wrong. The stack is not about storing program data, it is about storing program state.
Large amounts of data should be on the heap, the stack is only what keeps the program code together, it is the backbone of the application, not its data base.
Try this instead:
QVector<YourType> data(100000000);
Provided the system can allocate enough memory, you now can use that data with the standard array []
operator.
Keep in mind that 100m int
s are already over 380 mb. Even if you increase the stack size, nobody uses 380 mb stacks, the typical stack size is usually no more than a few megabytes, and that is good enough to work for immensely large applications. If your data type is larger, it will require even more continuous memory, so depending on your system and compiler, it is entirely possible that such an allocation cannot be made even on the heap.