-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garbage Collection Basics #2
Comments
At the Basics level, this series should be limited to single-threaded mutator/gc stop-the-world collection. Are there any reasons to not cover a basic implementation of copying collection such as Cheney's algorithm at this level? That might make a smoother transition to advanced gc #3. Possible breakdown:Mark and sweep collection
Copying collection
|
Since copying and mark-and-sweep are a bit different I think we could do both, then stick with one of the two for the rest of the book. |
Just had the realization that an Since we don't have access to compiler generated stack maps, I think this means that a moving collector in Rust would rely on gc safe points and never call the collector inside If so, Cheney's algorithm as classically described isn't possible because allocation is triggered on OOM, which you only know you've reached for certain inside Does this all sound correct @yorickpeterse ? |
@pliniker This depends a bit on what you consider to be "registers". For example, in Inko the "registers" are just indexes in a Rust For the sake of simplicity we could do something similar where we use a dedicated data structure for the stack/register, instead of relying on the Rust call stack and registers. |
Another option is to slightly adjust Cheney's algorithm and don't immediately trigger GC in an allocation, instead waiting until reaching a safepoint. |
@yorickpeterse Having re-read the Immix paper, I think I see better why you favor it 🙂 and I have to agree. I'm now thinking that the Basics chapter(s) might best be designed to build toward Immix: block-size-aligned blocks (#9), basic bump allocation (#4), mark & sweep. This leaves major issues unaddressed and doesn't result in a practically usable GC yet - line marking, allocating into partially reclaimed blocks, defragmentation, parallelizing etc need to be covered in the Advanced chapter(s). This feels a lot more targeted and focused to me, now. Perhaps it's what you were originally suggesting? |
@pliniker That sounds like a good idea, even if it's just because it saves us from having to cover two very different algorithms. |
Depends on: |
The book should include a chapter (or series of multiple chapters) discussing the basics of garbage collection and how to tackle this using Rust. The end goal should be a set of resources to implement a naïve, non-moving mark-and-sweep garbage collector. While such a GC won't be very useful for most applications it's easy enough to understand/explain that it should serve as a good introduction.
The text was updated successfully, but these errors were encountered: