Skip to main content

Memory

How Rust manages memory: where values live, when they're freed, and the allocator interface.

Stack vs HeapWhen Rust allocates on the heap, and why it matters
Drop OrderDeterministic destruction, ManuallyDrop, forget
Global AllocatorCustom allocators via #[global_allocator]
Memory LayoutAlignment, padding, repr(C), repr(packed)
Leaksmem::forget, Rc cycles, when leaking is intentional