3 ms·
Reference counting and garbage collection are different. They’re both forms automatic memory management, but they work in very different ways.
by MBCook 2y ago
Reference counting and garbage collection are different.
They’re both forms automatic memory management, but they work in very different ways.
- vips7L 2y agoNo they're not. Reference counting is a garbage collection algorithm. Its even described as such in most literature on garbage collection.
- kibwen 2y agoReference counting and garbage collection are different, yes. But in terms of classifying "no garbage collection" under "things that Swift took from Rust", Swift's pervasive reference counting is much closer to classic tracing GC than it is to Rust's system of single ownership.
- pcwalton 2y agoAutomatic memory management is a synonym for garbage collection. Reference counting is a form of garbage collection.