3 ms·
Reference counting is a form of GC. The problem with reference counting is that it don't work with recursive structures and counters may overflow. Overflow or
by nabla9 9y ago
Reference counting is a form of GC.
The problem with reference counting is that it don't work with recursive structures and counters may overflow. Overflow or reaching some max value and returning runtime error are both problems.
- vlovich123 9y agoOn 64-bit platforms you're not going to overflow the counter. 32-bit platforms these days are embedded & they too are highly unlikely to overflow the counter. Recursive structures are a problem although in my experience you can usually just alter the ownership rules a bit instead. FWIW there's a Rust GC library that provides opt-in GC for when you need it. https://github.com/Manishearth/rust-gc https://github.com/Manishearth/rust-gc