

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 9
click for more info
Not enough gems
Cost: 6 gems
1: Handling Cycles
incomplete
2: Pros and Cons
incomplete
3: Stack Frames
incomplete
4: Tracking Objects
incomplete
5: Free
incomplete
6: Frame References
incomplete
7: Mark and Sweep
incomplete
8: Mark
incomplete
9: Trace
incomplete
10: Sweep
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
TODO: Would it be funny to just have a video clip of me going "MAAARRKKKK" and that's it?
I'd advise against it.
In some mark and sweep implementations you'll see different ways to mark "root objects" – the objects directly referenced by stack frames. However, in our simplistic VM it's a bit easier to find and mark all of the directly referenced objects. You'll see why when you write it in a moment.
Complete the mark function in vm.c. It should set every object that's directly referenced by a stack frame to is_marked = true.