- What the stack and heap are conceptually
- What typically lives on the stack vs the heap
- Value types vs reference types
- Pure stack value types
- Heap-backed value types and copy-on-write (COW)
- Reference types and heap allocation
- ARC’s relationship with heap memory
- Performance implications of stack vs heap
- Real Swift/iOS scenarios where stack vs heap matters
1. What the Stack Is
The stack is a fast, automatically managed memory region used for:
- Function calls
- Local variables
- Value-type storage (when possible)
Stack memory is:
- Scoped
- Thread-local
- Allocated and freed automatically