3 ms·
Sure, most of the links are in the posts I wrote about it: https://www.oilshell.org/blog/2022/10/garbage-collector.html https://www.oilshell.org/blog/2022/10/g
by chubot 3y ago
Sure, most of the links are in the posts I wrote about it:
https://www.oilshell.org/blog/2022/10/garbage-collector.html https://www.oilshell.org/blog/2022/10/garbage-collector.html
https://www.oilshell.org/blog/2023/01/garbage-collector.html https://www.oilshell.org/blog/2023/01/garbage-collector.html
AFAIK, the Cheney algorithm is the only way to do copying/moving GC. It's tiny and elegant, and I took a picture of it for a contributor:
https://app.oilshell.org/picdir/resize?name=193n849__4477C231-A723-4D13-A4EC-5904428ADECE.jpeg&max-width=1000&rotation=1 https://app.oilshell.org/picdir/resize?name=193n849__4477C23...
The GC handbook explanation was better than anything I found online, including in wikipedia.
But GC handbook is also not engineering-focused (see blog posts). It surprisingly difficult to write a GC -- I have new respect for this problem!
As mentioned, we ended up going to a non-moving collector, mainly because debugging is harder, it breaks tools, and it involves even more rooting. And rooting problem is hard, especially in C/C++.
The GCs in C++ like v8 and SpiderMonkey are a bit hard to read -- it is almost like a special dialect of C++. I found the plain C femtolisp and es shell easier to read. And some toy examples on Github, but many of them (even from engineers I know to be great) were VERY incomplete, and not designed in context.
Don't trust an example GC that hasn't been used in production! It probably has bugs or a bad API for rooting!
femtolisp is probably the closest thing to "small" and "used in production" that I found (since it's used to bootstrap Julia)