Disadvantages of using large variables/arrays on the stack?
问题 What are the disadvantages, if any, of defining large arrays or objects on the stack? Take the following example: int doStuff() { int poolOfObjects[1500]; // do stuff with the pool return 0; } Are there any performance issues with this? I've heard of stack overflow issues, but I'm assuming that this array isn't big enough for that. 回答1: Stack overflow is a problem, if the array is larger than the thread stack the call tree is very deep, or the function uses recursion In all other cases, stack