#memory
9 articles about memory
Filter by topic
What is &mut *x (reborrow) in Rust, and why does it freeze the original reference?
A reborrow duplicates the reference, not the data, and freezes the original for its duration. What &mut *x really does.
Mutable vs. immutable borrows: the two rules
The two borrowing rules, why exclusivity is the one that matters, and what the borrow checker actually rejects.
Where do string literals (&str) live?
String literals live in the binary's read-only data with a 'static lifetime — what that means for allocation, copying, and returning them.
What is the purpose of Box<T> in Rust?
What Box<T> is for, what the extra indirection costs, and when a heap allocation is the right call rather than a reflex.
Why &str Won't Fit &String in Rust: Fun Fixes for String Mismatches!
Why passing a &str where a &String is expected fails to compile, what deref coercion does and doesn't do, and how to fix the mismatch.
How does Rust prevent dangling pointer at compile time?
Why a dangling pointer is a compile error in Rust rather than a crash in production, and how lifetimes make that check possible.
How does ownership prevent memory leaks and data races?
How the ownership rules close off memory leaks and data races before the program ever runs, and where they stop short.
Stack vs. Heap in Rust: Where Does Your Data Live?
What actually decides whether a value lands on the stack or the heap in Rust, and what each choice costs you at runtime.
How does Rust ensure memory safety without a garbage collector?
Ownership, borrowing and lifetimes give Rust memory safety at compile time, with no collector and no runtime pauses to budget for.