Crate audio_garbage_collector

Source
Expand description

Batteries included solution to using reference counted values on the audio-thread.

Wraps basedrop so that smart pointers are dropped on a background thread. Exposes a default global GC thread and helpers to create pointers attached to it.

§Collection frequency

Collection is based on polling the queue every 100ms by default.

If references are created and dropped very frequently this strategy is not adequate. This also adds some small overhead.

Structs§

GarbageCollector
Wraps basedrop::Collector with a polling GC thread.
Handle
A handle to a Collector, used when allocating Owned and Shared values.
Owned
An owned smart pointer with deferred collection, analogous to Box.
Shared
A reference-counted smart pointer with deferred collection, analogous to Arc.
SharedCell
A thread-safe shared mutable memory location that holds a Shared<T>.

Enums§

GarbageCollectorError
Errors that may be emitted when stopping the GC

Functions§

current
Return a reference to a global GC instance
handle
Return a handle to a global GC instance
make_shared
Create a new basedrop::Shared value using the default global GarbageCollector instance.
make_shared_cell
Create a new basedrop::SharedCell value using the default global GarbageCollector instance.