#gc #garbage-collector #allocator #bdwgc

nightly boehm_gc

Rust allocator and interface for the Boehm GC

1 unstable release

Uses old Rust 2015

0.0.1 Sep 8, 2015

#15 in #garbage-collector

MIT license

11KB
131 lines

boehm_gc for Rust

This crate is a prototype that provides an allocator to Rust that has the ability to root garbage-collected pointers allocated by the Boehm GC.

The ability to swap out the Rust allocator is a very new feature that will require a recently nightly to take advantage of. I've done a few tests on this crate and it does work - pointers allocated by boehm_gc::gc_allocate are rooted by anything that is allocated by the system allocator used by std.

This crate does require that you have libgc installed on your system. It can usually be obtained through your package manager of choice (I used homebrew on OSX just fine).


lib.rs:

boehm_gc is an allocator crate that provides an interface to the Boehm conservative garbage collector. The allocator that this crate provides ensures that all objects that it allocates will root any GC'd pointers that the objects may contain. GC'd pointers are allocated using the gc_allocate function and are freed automatically as they become unreachable.

This crate can only be used with recent Rust nightlies due to the allocator feature being brand new.

No runtime deps