TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How to Implementing Garbage Collection Algorithms

5 pointsby shefaliprateekover 8 years ago
I have always been interested in garbage collection algorithms and language runtimes. And recently got my hands on &quot;The Garbage Collection Handbook&quot;[1].<p>My questions is, how can I go about implementing these algorithms :<p>- are there any student focused language VMs that anyone can recommend ?<p>- or any other recommendations on how to go about them?<p>[1] http:&#x2F;&#x2F;gchandbook.org&#x2F;

2 comments

hackermailmanover 8 years ago
The Art of Computer Programming Vol 1: Fundamental Algorithms has a chapter on GC for linked lists which is interesting and shows implementation, there&#x27;s also the Golang forums&#x2F;mailing lists which discuss GC and it&#x27;s optimization <a href="https:&#x2F;&#x2F;blog.golang.org&#x2F;go15gc" rel="nofollow">https:&#x2F;&#x2F;blog.golang.org&#x2F;go15gc</a><p>SICP also has a chapter on GC w&#x2F;implementation <a href="https:&#x2F;&#x2F;mitpress.mit.edu&#x2F;sicp&#x2F;full-text&#x2F;sicp&#x2F;book&#x2F;node117.html" rel="nofollow">https:&#x2F;&#x2F;mitpress.mit.edu&#x2F;sicp&#x2F;full-text&#x2F;sicp&#x2F;book&#x2F;node117.ht...</a><p>Universities have some lectures on this too and you can look up the algorithms they mention<p><a href="https:&#x2F;&#x2F;suif.stanford.edu&#x2F;~courses&#x2F;cs243&#x2F;lectures&#x2F;l14.pdf" rel="nofollow">https:&#x2F;&#x2F;suif.stanford.edu&#x2F;~courses&#x2F;cs243&#x2F;lectures&#x2F;l14.pdf</a> Intro to GC<p><a href="http:&#x2F;&#x2F;web.stanford.edu&#x2F;class&#x2F;cs243&#x2F;lectures&#x2F;L17-Advanced-GC.pdf" rel="nofollow">http:&#x2F;&#x2F;web.stanford.edu&#x2F;class&#x2F;cs243&#x2F;lectures&#x2F;L17-Advanced-GC...</a> Advanced GC
bjourneover 8 years ago
A prerequisite to that book is understanding objects and pointers. With that I mean how they are represented in actual memory. We don&#x27;t have to deal with those details when using HLLs. E.g the book talks a lot about &quot;slots&quot; but it is useless unless you understand how a slot and how a reference to a slot is implemented.<p>Therefore firm knowledge of C is required. Then when you have that knowledge, you can build an object model. I suggest starting with just two simple types: array and integer objects.<p>Then you can implement simple memory management. The easiest is probably to begin with reference counting. After you have that, continue with mark and sweep, copying collection and more advanced techniques.