2 ms·
> with safe Rust you get all the memory-safety advantages of Java or Lisp, without a GC Safe Rust does not protect against memory/resource leaks when reference
by zozbot234 3y ago
> with safe Rust you get all the memory-safety advantages of Java or Lisp, without a GC
Safe Rust does not protect against memory/resource leaks when reference cycles are present. To avoid those, tracing GC is still needed - and most likely unavoidable in the general case. Note that avoiding reference cycles is a global concern that can't be localized to any single part of the program, so trying to ensure this statically is roughly as hard as proving that a random piece of C/C++ code does not corrupt memory.
You can of course stick to tree-like allocation patterns where object lifecycles nest cleanly, and that's what the borrow checker is all about. You can also use arenas/regions, and future Rust versions will hopefully make those easier to use.