[−][src]Crate shredder
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
drop
for'static
data - clean finalization: optional
finalize
for non-'static
data - 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
Gc
data requires acquiring a guard - multiple collectors: only a single global collector is supported
- can't handle
Rc
/Arc
: requires allGc
objects have straightforward ownership semantics - further parallelization: The collector needs to be optimized and parallelized further (will fix!)
- no no-std support: The collector requires threading and other
std
features (will fix!)
Modules
wrappers | Helpful wrappers used for convenience methods |
Macros
mark_send_type_gc_safe | A |
Structs
Gc | A smart-pointer for data tracked by |
GcGuard | A guard object that lets you access the underlying data of a |
GcSafeWrapper |
|
R | A |
RMut | A |
Scanner | Scanner is a struct used to manage the scanning of data, sort of analogous to |
Traits
EmptyScan | Helper trait for implementing an empty scan implementation |
Finalize | A trait implementing an alternative to |
GcSafe | A marker trait that marks that data can be managed in the background by the garbage collector. |
Scan | A trait capturing the ability of data to be scanned for references to data in a |
Functions
collect | A function for manually running a collection, ignoring the heuristic that governs normal garbage collector operations. |
number_of_active_handles | Returns how many |
number_of_tracked_allocations | Returns how many underlying allocations are currently allocated. |
run_with_gc_cleanup | A convenience method for helping ensure your destructors are run. |
set_gc_trigger_percent | Sets the percent more data that'll trigger collection. |
synchronize_destructors | Block the current thread until the background thread has finished running the destructors for all data that was marked as garbage at the point this method was called. |
Type Definitions
GMutex | A convenient alias for |
GRefCell | A convenient alias for |
GRwLock | A convenient alias for |
Derive Macros
Scan |