2 ms·
Rust doesn't aim to make it impossible to have memory leaks: https://users.rust-lang.org/t/memory-leaks-are-memory-safe/5288 https://users.rust-lang.org/t/memor
by cwzwarich 9y ago
Rust doesn't aim to make it impossible to have memory leaks: https://users.rust-lang.org/t/memory-leaks-are-memory-safe/5288 https://users.rust-lang.org/t/memory-leaks-are-memory-safe/5...
- ben-schaaf 9y agoIt at least eliminates what I'd estimate to be the most common cause of memory leaks (in C): missing a free. Which is the same guarantee that GCs provide.
- oconnor663 9y agoThe story is similar to C++. Almost all allocations are done by types that'll automatically call free in their destructors. But because there's no global GC, it's still possible to leak accidentally by creating a cycle in reference-counted smart pointers.
- fnord123 9y agoThere is still the other most common source of memory leaks: putting data into long living (e.g. 'static) hash tables and having no plan for pruning it.