3 ms·
> I know languages like Rust and Swift have ways of safely dealing with memory without a GC Those are very different things, to my knowledge. Rust is "no-GC"
by kbenson 7y ago
> I know languages like Rust and Swift have ways of safely dealing with memory without a GC
Those are very different things, to my knowledge. Rust is "no-GC" in the vein of C and C++ (but the borrow checker makes the memory management portion easier to deal in that you generally don't have to manually free stuff). Swift is "memory managed" in that is uses reference counts to automatically check through the used variables and free ones that are no longer references. In my eyes, that's pretty clearly a type of garbage collection, even if it seems the term has become specific enough that it's less often applied to that case.
- tombert 7y agoThe Swift ARC is not a "full" GC; it does have a runtime effect, but a lot of the work is done at compile-time, and no need for a background process like Java's GC. That said, technically you are correct, it is a GC, just one with a lot lower overhead than something like Java/C#/JavaScript/Python.