2 ms·
Rust doesn't prevent memory leaks. I thought I'd chime in since I see this claim often around these parts. See: https://doc.rust-lang.org/book/ch15-06-referenc
by hu3 6y ago
Rust doesn't prevent memory leaks. I thought I'd chime in since I see this claim often around these parts. See:
https://doc.rust-lang.org/book/ch15-06-reference-cycles.html https://doc.rust-lang.org/book/ch15-06-reference-cycles.html
> Rust combines no GC with no memory leaks by forcing you to prove to it that your algorithm doesn't leak anything. And you have to do this every time you want your code to compile.
- pkolaczk 6y agoWhile Rust may not guarantee freedom from memory leaks (probably no Turing complete language can), I find it makes a much better job on resource management than many other GCed languages. I find it is much easier to leak a file descriptor in Java than in Rust.
- orthoxerox 6y agoIt doesn't prevent all memory leaks, but its goal is the prevention of most memory leaks/buffer overruns and other memory management errors with zero runtime overhead.