3 ms·
While reference counting is technically a method of collecting garbage, in modern parlance the phrase "garbage collector" is mainly used for systems capable of
by bheadmaster 3y ago
While reference counting is technically a method of collecting garbage, in modern parlance the phrase "garbage collector" is mainly used for systems capable of collecting garbage of an arbitrary reference graphs, which reference counting by itself cannot do (cyclic references).
- avgcorrection 3y agoGeneral programming circles: “garbage collection” means only the “tracing” kind PL circles: reference counting is also “garbage collection”
- bheadmaster 3y agoI sincerely doubt that those two groups are disjunct, or that they use the phrase "garbage collection" exclusively in the contexts you wrote.
- naasking 3y agoAnyone worried about tracing garbage collection is worried about unpredictable costs of automatic reclamation. Even naive reference counting has unbounded pathological cases like this, like an infinite list with only one reference that dies, which triggers a cascade of infinite free ops. You can do some gymnastics like various types of deferrals to amortise the cost, but now you're getting into more sophisticated tracing-like runtime behaviour which has it's own unpredictability. There's no free lunch. Better static analysis that can aggregate various allocation into arenas/regions seems like the only way to make this trade-off better.