shredder
shredder is a library providing a garbage collected smart pointer: Gc.
This is useful for times when you want shared access to some data, but the structure
of the data has unpredictable cycles in it. (So Arc would not be appropriate.)
shredder has the following features:
- safe: detects error conditions on the fly, and protects you from undefined behavior
- ergonomic: no need to manually manage roots, just a regular smart pointer
- ready for fearless concurrency: works in multi-threaded contexts
- limited stop-the world: regular processing will rarely be interrupted
- seamless destruction: regular
dropfor'staticdata - clean finalization: optional
finalizefor non-'staticdata - concurrent collection: collection happens in the background, improving performance
- concurrent destruction: destructors are run in the background, improving performance
shredder has the following limitations:
- guarded access: accessing
Gcdata requires acquiring a guard - multiple collectors: only a single global collector is supported
- can't handle
Rc/Arc: requires allGcobjects have straightforward ownership semantics - optimized for speed, not memory use:
Gcis small, but internal data-structures can grow large (will fix!) - further parallelization: The collector needs to be optimized and parallelized further (will fix!)
- no no-std support: The collector requires threading and other
stdfeatures (will fix!)
Getting Started
Here is an easy example, showing how Gc works:
use RefCell;
use ;
If you're playing with this and run into a problem, go ahead and make a Github issue. Eventually there will be a FAQ.
Help Wanted!
If you're interested in helping with shredder, feel free to reach out.
I'm @Others on the Rust discord. Or just look for an issue marked help wanted or good first issue