o
odinpkg.dev
packages / library / mark-sweep-gc

mark-sweep-gc

13e90dalibrary

A mark and sweep GC allocator proof of concept for the Odin language

MIT · updated 4 years ago

Mark and Sweep GC

A mark and sweep GC allocator proof of concept for the Odin language.
Run odin run . at the root

This very much experimental.
Internally, the GC is using a Free list allocator to keep track of the allocations and their sizes. Right now, the GC requires user input to mark the root allocations during each collection cycle. I found it to be an okay middle ground, while giving the user more control over the GC.

To mark an allocation as still alive use the mark_*(gc_allocator_ptr, alloc_object) procedure group