Remix.run Logo
OtomotO 3 days ago

Ref counting is also no GC by the definition of a GC I was brought up with.

But yes, I was also thinking about the borrow checker.

Not necessarily in Rust, as other languages start to adopt similar techniques.

shakna 3 days ago | parent | next [-]

Maybe not how you were brought up, and people argue... But Watson & Watson, back in '87, described ref counting as "An efficient garbage collection scheme for parallel computer architectures".

Even the dragon book refers to ref counting as a form of garbage collection.

Line 2 of Ref counting's Wikipedia page refers to garbage collection.

People have argued since the invention in 1960, but... Ref counting is one form of GC. [0] It might not be a tracing GC, but it is GC.

[0] https://dl.acm.org/doi/10.1145/367487.367501

pron 3 days ago | parent | prev | next [-]

As refcounting and tracing are the two primary starting points for garbage collection, they're its two pillars so to speak (e.g. https://web.eecs.umich.edu/~weimerw/2012-4610/reading/bacon-...), I don't know of any serious person in the memory management space who doesn't see refcounting as a GC, although some languages with a refcounting GC say "they don't have a GC" in their marketing material.

As a general rule, tracing seeks to optimise for throughput while refcounting seeks to optimise for footprint, although the two can become more elaborate and converge (as shown in the paper I linked).

pjmlp 3 days ago | parent | prev | next [-]

Then somehow someone has taught you badly, any proper CS reference book in academia has it, like the famous GC Handbook,

https://gchandbook.org/

The other languages adopting such type systems, also keep automatic resource management around for productivity.

The ones that don't, are still in the looking for meaningful adoption stage.

vips7L 3 days ago | parent | prev [-]

Most academic definitions of garbage collection include reference counting. It’s just a form of it.

https://gchandbook.org/contents.html