gc/README.md
This directory contains implementations for Ruby's garbage collector (GC). The GC implementations use the Modular GC API to interact with Ruby. For more details about this API, see the Modular GC API section.
Two GC implementations are included in Ruby:
[!TIP] If you are not sure how to build Ruby, follow the Building Ruby guide.
[!IMPORTANT] Ruby's modular GC feature is experimental and subject to change. There may be bugs or performance impacts. Use at your own risk.
--with-modular-gc=<dir> option, where dir is the directory you want to place the built GC libraries into.make install-modular-gc MODULAR_GC=<impl>. This will build the GC implementation and place the built library into the dir specified in step 1. impl can be one of:
RUBY_GC_LIBRARY=<lib> environment variable, where lib could be default, mmtk, or your own implementation (as long as you place it in the dir specified in step 1).[!WARNING] The Modular GC API is experimental and subject to change without notice.
GC implementations interact with Ruby via the Modular GC API. All implementations must provide the functions in gc/gc_impl.h for Ruby to hook into. GC implementations can use any public C API in Ruby, along with additional APIs defined in gc/gc.h.
Additionally, create an extconf.rb file to build the GC library. This file must use gc/extconf_base.rb and the create_gc_makefile method.