Skip to main content

Module sync

Module sync 

Source
Expand description

Thread-safe shared garbage collection.

Most users of this module will be interested in using Gc directly out of the box - this will just work. Those with more particular needs (such as benchmarking) should turn toward set_collect_condition in order to tune exactly when the garbage collector does cleanups.

§Examples

use dumpster::sync::Gc;

let my_gc = Gc::new(100);
let other_gc = my_gc.clone();

drop(my_gc);
drop(other_gc);

// contents of the Gc are automatically freed

Macros§

coerce_gc
Allows coercing T of Gc<T>.

Structs§

CollectInfo
Information passed to a CollectCondition used to determine whether the garbage collector should start collecting.
Gc
A thread-safe garbage-collected pointer.

Functions§

collect
Begin a collection operation of the allocations on the heap.
default_collect_condition
The default collection condition used by the garbage collector.
set_collect_condition
Set the function which determines whether the garbage collector should be run.

Type Aliases§

CollectCondition
A function which determines whether the garbage collector should start collecting. This type primarily exists so that it can be used with set_collect_condition.