Next.js Hacker News
  • top|
  • new|
  • ask|
  • show|
  • jobs|
  • GitHub
Writing a .NET Garbage Collector in C# – Part 6: Mark and Sweep
36 points by vyrotek 5 days ago | 3 comments
  • wsve
    Writing an efficient garbage collector in a garbage collected language is actually very funny to me. Neat project!
    • WorldMaker
      It's a relative to self-hosting. If a language can be compiled in itself the compiler also becomes one of the first tests of language compatibility. Similarly, if you can write low-level pieces like a garbage collector in the the higher-level language itself you can maybe save transitions to and from lower level code and help prove the language is useful in lower level scenarios. It's maybe backwards to expectations but a lot of .NET improvements over the years has just been moving low level code from C++ to a low level subset of C# to avoid thread stack transitions and/or gift the JIT and AOT compilers with more tools to inline low level code. There have been experimental GCs in the .NET Runtime written in C# for the exact same reason. There likely will be again.
    • pjmlp
      Some other ones, in case you aren't aware of.

      Oberon,

      https://www.projectoberon.net

      Go,

      https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199c...

      https://github.com/golang/go/blob/2bd7f15dd7423b6817939b199c...

      D,

      https://github.com/dlang/dmd/tree/master/druntime/src/core/i...

      Or even Smalltalk,

      https://github.com/pharo-project/pharo-vm/blob/pharo-10/smal...

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact