← Back to context

Comment by pjmlp

1 day ago

Reference counting is chapter 5 on the linked book.

I said "a GC", that is, "a garbage collector". Even if you consider reference counting as technically being garbage collection, purely reference counted systems do not have a distinct entity that can be identified as "a" garbage collector. So I'm technically correct here even in face of this pedantry.

Not that I think it's a reasonable approach to language to be pedantic on this. RC being GC is, of course, true from an analytic approach to language: a garbage collection system is defined as a system that collects and frees objects that are unreachable and thus dead; a reference counting pointer collects and frees objects that are unreachable and thus dead; therefore, reference counting is garbage collection.

One problem with this is the vagueness: now, the use of a call stack is garbage collection; after all, returning from a function collects and frees the objects in the stack frame. Leaking memory all over the place and expecting the operation system to clean up when you call `exit()` likewise is "garbage collection".

But more importantly, it's just not how anyone understands the word. You understood perfectly well what I meant when I said "you would be hard-pressed to find a modern AA game that does not already use a GC"; in other words, you yourself don't even understand the word differently. You merely feel an ethical imperative to understand the word differently, and when you failed to do so, used my comment as a stand-in to work through the emotions caused by your own inability to live up to this unfulfilled ethic.

  • Except they do, when one bothers to read computer science reference literature, instead of blog posts from folks that learned programming on their own way.

    Being pedantic is required mechanism to fix urban myths, that is how we end up with he says, she says, adultered knowledge.

    All those "garbage collection" variations are exactly the proof what happens when people on the street discuss matters without having a clue about what they are talking about, it is like practice medecine with village recipes "I hear XYZ cures ABC".

    It is not vague, IEEE and ACM have plenty of literature on the matter.

Reference counting isn’t garbage collection.

  • It absolutely is (and as per another thread under another post, both pjmlp and me are notorious for correcting people on this specific point)

    • They are not interchangeable. The semantics are observably different. Therefore, RC is not GC.

      Reference counting gives you eager destruction. GC cannot.

      GC gives lets you have garbage cycles. RC does not.

      I think a part of the GC crew reclassified RC as GC to try to gain relevance with industry types during a time when GC was not used in serious software but RC was.

      But this is brain damage. You can’t take a RC C++ codebase and replace the RC with GC and expect stuff to work. You can’t take a GC’d language impl and replace the GC with RC and expect it to work. Best you could do is use RC in addition to GC so you still keep the GC semantics.

      7 replies →

  • It surely is from computer science point of view, now that many prefer street knowledge, is another matter.

    • Someone saying that they are the same isn’t “science”.

      What is science is programming language semantics, and by that science, RC and GC are different.

      1 reply →