Alternative garbage collectors

Seeing Serdar’s gcry shard to replace the BDW garbage collector with one written entirely in Crystal has got me wondering about other alternatives. I haven’t tried his yet in prod, so I can’t speak about how well it works, but one thing that I’ve run into a lot with Boehm is that once a heap page is allocated, it’s frequently retained for the life of the program. I understand why that happens, but that kind of bloat can be irritating.

For a few years, I’ve been wishing for a compacting GC in Crystal, but there’s a compacting allocator developed at the University of Massachusetts called Mesh that removes the need for the GC to do the compacting. I’ve been hoping for a while could be worked into Boehm, but if the GC can be built around the strengths of Mesh instead of shoehorning Mesh into one designed around a different allocator, that might be better.

There was a session at Strangeloop 2019 about Mesh where the presenter used it with Ruby and Redis and it showed meaningful memory improvements even 7 years ago.

I’m curious what folks think about this