3 ms·
Incorrect, Swift is not garbage collected. It uses reference counting. Read more here: https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCountin
by sgt 5y ago
Incorrect, Swift is not garbage collected. It uses reference counting. Read more here: https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html https://docs.swift.org/swift-book/LanguageGuide/AutomaticRef...
As for C and C++, yes, of course. I meant "everyone else" as in the trendy new languages.
- saagarjha 5y agoReference counting is technically a form of garbage collection, FYI.
- sgt 5y agoReference counting deals with operations that have constant time, which I think puts it in a different category than what people normally view as GC.
- Zababa 5y agoI'm not sure that's true. Python mainly uses RC, yet most people think of Python as GC'd. I would argue that most people think that GC == automatic memory management.
- sgt 5y agoYes, I think you are correct actually.
- kaba0 5y agoAnd has a different tradeoff, due to atomic operations being needed for objects shared between threads (and of course, circular references). But no matter what, it is literally a GC algorithm, described in every book about GCs.