News for hackers. Stuff that matters.
Re:For Better Computing, Liberate CPUs from Garbage Collection by geocar on Thursday May 09, 2019 @06:54AM (#19867009)
In taxonomy, I say we have "automatic memory management" when we have some kind of `malloc()` type device and no need to `free()` it.

Garbage collection is about visiting live objects to figure out what's alive and ignoring the dead stuff. Every theory about why GC can work (or be useful) is predicated on the idea that there is more garbage than live objects so you're touching less stuff.

If all you do is mark/sweep, you're visiting the garbage as well, so GC research has led neatly into moving collectors (which don't ever touch the garbage). That's a win, and that's why GC is worth study.

There are other kinds of "automatic memory management" though: reference counting, arena allocators (at a stretch), and object memory (I've only seen this on mainframes), and they're all worth some attention.

Re:For Better Computing, Liberate CPUs from Garbage Collection by barrkel on Thursday May 09, 2019 @07:02AM (#19867045)
> Garbage collection is about visiting live objects to figure out what's alive and ignoring the dead stuff

That's a description of tracing GC, not a definition of GC.

GC is whatever technology that enables what you've called automatic memory management: a kind of illusion that there is infinite memory, from the programmer's perspective.

That might involve some mix of reference counting (Python is probably the biggest example), tracing (what you seem to think is all of GC), data flow analysis (e.g. escape analysis in some Java GC / JIT integration), etc.

Re:For Better Computing, Liberate CPUs from Garbage Collection by geocar on Thursday May 09, 2019 @07:27AM (#19867171)
> GC is whatever technology that enables what you've called automatic memory management: a kind of illusion that there is infinite memory, from the programmer's perspective.

That's definitely not what McCarthy meant by it. I understand that's probably a common view nontheless, but I can use sbrk() and the fact my computer has gobs of ram/swap, and I'm not going to call that garbage collection. I don't think this definition is useful.

If you re-read what I wrote now understanding what I mean when I say "garbage collection", perhaps we can talk about strategies for providing that infinite view of memory instead.

Re:For Better Computing, Liberate CPUs from Garbage Collection by barrkel on Thursday May 09, 2019 @05:44PM (#19872736)
Actually, I think process termination is pretty useful as garbage collection. It's normally much more reliable for releasing resources, for one thing. And there's little sense in cleaning up RAM when you're just going to quit.
Re:For Better Computing, Liberate CPUs from Garbage Collection by geocar on Friday May 10, 2019 @08:19AM (#19877015)
The kernel still deallocated those pages as an explicit [manual] result of a free-like call -- that just so happens to be named exit().

To seriously tell people that every C program running on unix has automatic "garbage collection" built-in seems like it would create very confusing conversations.

Re:For Better Computing, Liberate CPUs from Garbage Collection by seanmcdirmid on Thursday May 09, 2019 @07:09AM (#19867070)
GC has always meant tracing GC while reference counting (ever since McCarthy invented it) was considered another form of automatic memory management (like using arenas, doing escape analysis, etc...). Only recently in hacker news have they become all merged into the same word, for some reason.
Re:For Better Computing, Liberate CPUs from Garbage Collection by chrisseaton on Thursday May 09, 2019 @08:15AM (#19867518)
> Only recently in hacker news have they become all merged

This is demonstrably not true. The Garbage Collection book by Jones is the key text in this area, and it covers reference counting under that term. It was published in 1996, before Hacker News existed.

There is also Bacon's Unified Theory of Garbage Collection, 2004, which said the two are on a spectrum that meets in the middle.

> all high-performance collectors (for example, deferred reference counting and generational collection) are in fact hybrids of tracing and reference counting

Re:For Better Computing, Liberate CPUs from Garbage Collection by mcguire on Thursday May 09, 2019 @01:43PM (#19870396)
The updated Garbage Collection Handbook does as well.
Re:For Better Computing, Liberate CPUs from Garbage Collection by pjmlp on Friday May 10, 2019 @07:39AM (#19876824)
That reason are academic worthy books describing garbage collection algorithms, I can provide a couple of them.

Lets start with the Garbage Collection Handbook, chapter 5.