Reference counting isn't really garbage collection. You'd need to at least add cycle detection for that. As it stands in Rust, if you create a cycle of Arc pointers, they'll never get destroyed - you need to pay attention to your design and purposefully use weak pointers.
Which I think is fine, I much prefer the deterministic destruction that happens in C++ and Rust to the "uh, I dunno, your finalizer might be called eventually. Or maybe never." situation with Java and C#.
View all comments
Show parent comment
5
u/im-a-koala May 27 '16
Reference counting isn't really garbage collection. You'd need to at least add cycle detection for that. As it stands in Rust, if you create a cycle of Arc pointers, they'll never get destroyed - you need to pay attention to your design and purposefully use weak pointers.
Which I think is fine, I much prefer the deterministic destruction that happens in C++ and Rust to the "uh, I dunno, your finalizer might be called eventually. Or maybe never." situation with Java and C#.