← Back to context

Comment by m3kw9

3 years ago

Who would usually need this book?

The first edition is a definitive reference for anyone writing a garbage collector (and by extension, exploring writing a programming language). Also people who are interested in how GCs work.

Probably less so for people trying to optimize a program to work with an existing GC (eg. tweaking the JVM), but I suppose knowing the basic principles can help.

I’ve written two garbage collectors in my time, neither of which were in a programming language.

One was for an in memory cache of data relationships. Another was to clean up soft references with an RDF graph. Neither were, nor needed to be, particularly sophisticated.

The cache was a compacting collector, the RDF one was mostly a “connectedness” test, pruning those nodes fallen from the graph.

Recall that malloc has a simple garbage collector for its free space, and arguably the level of sophistication that ranks a modern malloc implementation is how it manages its free space.

In the end detritus must be identified and resources reclaimed. So you see how GC like systems can occur in divergent areas of work.

This book (the 1st edition) gave me exactly what I needed when writing the garbage collector for my programming language.

Besides the great technical content, I found it to be a very enjoyable, readable book.

I read the mark-and-sweep GC parts to gain some deeper understanding about Go's garbage collector. Probably the best resource for that kind of stuff other than reading actual code.