• Back to the stack vs the heap
• It is tempting to allocate as much as possible to the stack
• However the stack has very real memory size limits (1M – 8M in
general)
• Another important distinction is that stack usage is determined at
compile time.
• So, we can allocate static arrays to the stack but not dynamic arrays
• The heap is allocated at run-time
• There are many times we don’t know how big an array we need, or how many
objects we need to allocate, that forces us to allocate resources to the heap
• Bottom line – RAM is not as important a measure for many
applications because memory is swapped to disk as needed
• Of course, if you use a lot of memory and start swapping, performance will be
significantly impacted