Quote:Original post by Goishin
Assuming that's correct
Technically, 'new' and 'new[]' allocate from the freestore, which is part of why you can't mix and match new/delete calls with malloc/free calls. (Note that you also cannot mix new/delete calls with new[]/delete[] calls.)
Quote:aren't there limits to using stack memory?
Yes.
Quote:And if there are, how do I find out what the sizes are (I'm assuming that this is operating system dependent)?
They're platform-dependent, and you usually find out (if you do) by running out.
Quote:Let's say I have some big huge array that I suddenly decide absolutely has to be on the stack
No such thing; trust me.
Quote:is there some way of dynamically resizing a stack to make room for it?
Not dynamically, no.
Quote:For that matter, are there pros/cons (other than memory size limitations) I would want memory from one or the other?
Not that are likely to matter for most programmers, no. Generally, KISS; the decision about where things go in memory depends on the quality of the needed memory (i.e. is there a specific, logical size it should be, as opposed to "this should be enough"?) rather than the quantity. When you *do* allocate from the freestore, use smart containers like std::vector that let you deal with memory *as if* it were on the stack, and be happy.