HN Books @HNBooksMonth

The best books of Hacker News.

Hacker News Comments on
Garbage Collection: Algorithms for Automatic Dynamic Memory Management

Richard Jones, Rafael D Lins · 7 HN comments
HN Books has aggregated all Hacker News stories and comments that mention "Garbage Collection: Algorithms for Automatic Dynamic Memory Management" by Richard Jones, Rafael D Lins.
View on Amazon [↗]
HN Books may receive an affiliate commission when you make purchases on sites after clicking through links on this page.
Amazon Summary
Modern software places increasing reliance on dynamic memory allocation, but its direct management is not only notoriously error-prone. Garbage collection eliminates many of these bugs. This reference presents each of the most important algorithms in detail, often with illustrations of its characteristic features and animations of its use.
HN Books Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this book.
The last book on the JVM itself (e.g. stack-based byte code, class file format) I saw was from nearly 20 years ago. I cannot think about anything more modern. It's a niche which used to be popular in FinTech circles mostly. As such valuable info was scattered across random blogs and the JVM spec itself.

"Garbage Collection: Algorithms for Automatic Dynamic Memory Management" (https://www.amazon.com/Garbage-Collection-Algorithms-Automat...) seems to cover GC algorithms up to the CMS.

"The Art of Multiprocessor Programming" (https://www.amazon.com/Art-Multiprocessor-Programming-Mauric...) is for those bored by JCiP. But it's not about threads per se. I imagine nobody cares about the original green threads and I wouldn't expect quality literature on the subject until project Loom goes to prod.

If you mean the jones/lins book, it's excellent[0]. Fully recommended to all.

[0] https://www.amazon.co.uk/gp/product/0471941484 I think there's a 2nd edition but I can't find it.

mangamadaiyan
> 2nd edition but I can't find it

Perhaps you're referring to this one [1]?

[1] https://www.amazon.co.uk/Garbage-Collection-Handbook-Managem...

tempguy9999
Thanks, I think I was confusing that with the 2nd ed, which doesn't seem to exist (in fact there is a 1999 2nd printing of the 1996 book with a different cover but with the same ISBN, just to make things worse, https://www.cs.kent.ac.uk/people/staff/rej/gc.html, so if you want to buy the later one which incorporate the errata from the first printing, check his website first. Publishers do make a mess of things sometimes).

Jones' website https://www.cs.kent.ac.uk/people/staff/rej/gc.html is excellent too.

Dec 20, 2016 · pjmlp on Modern garbage collection
Actually C++ got a tracing GC API in C++11.

As for the rest, RC is GC.

Check chapter 5 in one of the most widely academic accepted books about GC algorithms.

https://www.amazon.com/Garbage-Collection-Algorithms-Automat...

gpderetta
> Actually C++ got a tracing GC API in C++11.

Technically true, but in reality it is just a token effort to please Hans Bohem and get him to focus on designing the C++ concurrent memory model instead :).

As of today, I don't think any implementation actually offers optional GC, so those functions are alway just trivially implemented.

Dec 20, 2016 · pjmlp on Modern garbage collection
Swift has a garbage collector.

https://www.amazon.com/Garbage-Collection-Algorithms-Automat...

Check chapter 5.

azinman2
To me, a true garbage collector means any cyclic references can be cleared. That is not the case in Swift... you can still leak memory.
pjmlp
Which is not true if a data structure happens to have a strong reference, like in a cache or event handler, thus "leaking" in a true garbage collector.
azinman2
That doesn't defeat the definition of a garbage collector. You wouldn't then say no GC exists... but in the case of no inbound references then that's memory that can definitively be cleared.
kibwen
I think it's both fair to say that reference counting is a form of garbage collection (dynamic lifetime determination is dynamic lifetime determination), but also remark that reference counting has notably distinct performance characteristics (some good, some bad) compared to a tracing collector.
pjmlp
Both being GC algorithms, what one should discuss is implementation advantages and disadvantages of each algorithm.

Just like sorting or graph navigation algorithms get discussed, for example.

However somehow we get this pop culture of GC vs RC instead.

There is a lot of data on this topic.

This is a good starting place: http://www.amazon.com/Garbage-Collection-Algorithms-Automati...

Jul 06, 2010 · sb on The Most Important Algorithms
Very nice presentation!

In A* if you use a heuristic to select an edge (using a priority queue, i.e., your #3) it gives a best-first search. But it is is possible to just use a stack/queue an forget about the heuristic, then you get a nice generic way of tree (graph) traversal.

Regarding your use of white/black/grey lists: in a tree (which is acylic), you would only need a list of nodes to visit, however, in a general graph you need to keep a list of nodes that you have already seen/visited so as not to get into a cycle when the graph is cyclic. In tracing garbage collection algorithms this is often used because the live program data generated by the mutator is cyclic, or at least potentially can be. Thanks for mentioning this, though I know my way around gc stuff, too, I would have never come up with this link here! Probably it is a good advice to anybody interested to spend some time reading into garbage collection algorithms, they contain many interesting algorithms on graphs, such as the Deutsch-Schorr-Waite algorithm for tree traversing without requiring an additional stack. The definitive book on garbage collection is 1996's Jones and Lins: http://www.amazon.com/Garbage-Collection-Algorithms-Automati...

Programming Language Pragmatics by Michael L. Scott: The explanations of many things I'd read in other sources are no less than fantastic, I now understand a bunch of things I had only superficially "got" previously. http://www.amazon.com/Programming-Language-Pragmatics-Third-..., check out the overview and reviews.

Coders at Work by Peter Seibel: By far the best of this type of book (well, not counting the '80s classic Programmers at Work which I haven't read since then), one of the best Lisp authors interviews in depth a lot of really interesting and/or important people, from James Zawinski to Donald Knuth, with Javascript, static FP and PARC people, Guy Steele, Peter Norvig, Ken Thompson, Fran Allen (really important interview which points out how C/C++ to the exclusion of truly high level languages have been a disaster when used beyond their proper niches), etc. All are masters who've gotten their hands dirty, many are theory people as well. http://www.amazon.com/Coders-at-Work-Peter-Seibel/dp/1430219...

Garbage Collection by Jones Lins: Pretty much the only book in the field (except for the forthcoming Advanced Garbage Collection sequel in the middle of this year), covers the territory as of the mid-90s. Much more fun than trying to track down 100 individual papers and trying to make sense of it all. Exposition is clear and you get a real feeling for the subtleties of the field (especially when you try fun things like generational and/or concurrent GC). http://www.amazon.com/Garbage-Collection-Algorithms-Automati...

HN Books is an independent project and is not operated by Y Combinator or Amazon.com.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.