Rust theorytheory 0/50 · 0%
Memory · easy

9. Stack and Heap

Where values live.

Fixed-size values live on the stack. Growable data — String, Vec, Box — allocates on the heap with a small stack handle. Drops are deterministic at end of scope, so there is no GC pause.

Check your understanding

  1. 1. Where are Vec elements stored?

  2. 2. When is heap memory freed?