Never miss a beat

Join my newsletter.

Tag: memory-management

Boxing things in Rust

Published: 9/16/2021

Rust's memory management can feel a bit intimidating for most developers. Rust gives you some control over whether you're allocating data on the stack or the heap and its up to you to decide where memory should be allocated. When you allocate memory for values in Rust, that memory is allocated on the Stack . Memory on the Stack is allocated in a "stack frame" which contains information for the Stack's local variables and some metadata about that stack frame. When a function exits, that…