4 ms·
I mean, memory leaks are possible in Rust assuming the person explicitly uses unsafe code. However, most code does not use these unsafe blocks... and it should
by vitno 12y ago
I mean, memory leaks are possible in Rust assuming the person explicitly uses unsafe code. However, most code does not use these unsafe blocks...
and it should not be possible. Rust has a sound type system that uses linear affine typing. While their implementation is not "proven correct", in practice if the Rust compiler is working properly, leaks will not happen.
- Ygg2 12y agoI think it's possible to leak even in safe code if you misuse RC/ARC and the family. EDIT: Box don't leak.
- kibwen 12y ago`Box` won't leak, but `Rc` is just simple reference counting and can leak if you don't use weak pointers to break cycles.
- mercurial 12y agoWhat's keeping you from having a cache and forgetting to expunge it? It's fair to say that you have to work a lot harder in Rust to get a memory leak, while it requires no effort in C/C++, though.