3 ms·
The problem is that "garbage collection" as a term seems to have become synonymous with "tracing GC" (or, in other circles, "whatever the JVM does"). I've start
by kibwen 10y ago
The problem is that "garbage collection" as a term seems to have become synonymous with "tracing GC" (or, in other circles, "whatever the JVM does"). I've started using the term "dynamic lifetime determination" to refer to both tracing garbage collection and reference counting (with our without cycle detection, though the distinction matters). The question then is how pervasive a given language makes dynamic lifetime determination. In Java (GC) and Python (RC with CC), it's ubiquitous. In Go (GC with value types) and Swift (RC without CC), it's pervasive. In Rust and C++, it's selective (note that a large C++ codebase with shared_ptr everywhere would, effectively, be garbage-collected (to say nothing of e.g. Boehm)).
In contrast, C's automatic storage duration for stack-allocated items ( http://en.cppreference.com/w/cpp/language/storage_duration#Storage_duration http://en.cppreference.com/w/cpp/language/storage_duration#S... ) and Rust's system of ownership for heap-allocated items are things that I'd consider "static lifetime determination".
- marssaxman 10y ago> The problem is that "garbage collection" as a term seems to have become synonymous with "tracing GC" The term has been used that way since I first heard it back in the '80s, so it's probably not a battle worth fighting at this point. Yes, of course, there's a formal sense under which reference counting is just an outlying position within the broader world of garbage collection, but from an engineering point of view, it's a significantly different set of tradeoffs, and reference counting doesn't really qualify as the same thing when you're deciding how to structure your program.