← Back to categorized notes
systems / old wiki reference

The Stack and the Heap

memoryrustc++ 4 min

Stack values are cheap, scoped, and tied to a call frame. Heap values are flexible, shareable, and paid for with allocation and ownership complexity.

The useful maker question is not “which one is better?” but “which lifetime am I promising and who cleans it up?”

This becomes visible in systems languages: references, boxes, moves, and destructors are design tools, not trivia.