Hibernating Rhinos hackathon: The GC implementation

by Oren Eini

We run a hackathon in the office this past week which was quite a lot of fun. The idea was to build a simple GC for an API build in C.

Here is the original code. This is a (poorly written) C API that leaks memory by design. The idea was to build some form of a GC to handle the leaks.

Here are my attempts:

We then used the opportunity to go a little bit into how the GC in .NET works as well as looked into how boehm GC works.

If you go over the code, please note that it isn’t meant to be idiomatic C and that it was written in a rush. It is meant to be a skeleton for understanding, not anything you’ll actually use.

Woah, already finished? 🤯

If you found the article interesting, don’t miss a chance to try our database solution – totally for free!

Try now try now arrow icon