Real-Time Garbage Collector
A simple garbage collector which collects resources dropped on a realtime thread and safely deallocates them on another thread.
The performance characteristics of the provided smart pointers are equivalant to Arc when reading (but constructing them is a bit more expensive).
This crate also contains optional triple buffer types for syncing data (enable with the triple_buffer feature).
Optional support for no_std is provided through the use of bevy_platform.
This crate is similar to basedrop, except that it uses a simpler algorithm which makes use of standard library types as much as possible to greatly reduce the amount of internal unsafe code. (It is also not susceptible to memory leaks.) The drawback is that the collection pass is a bit more expensive than basedrop's implementation.
Example
use Duration;
use *;
let value_1 = new;
// Same as `ArcGc` but for `!Sync` data.
let value_2 = new;
// A simulated "realtime thread"
let rt_thread = spawn;
// A simulated update loop on the main thread
for _ in 0..4
You can also use a non-static collector with LocalRtGc (enabled in the local_collector feature).
Bevy support table
| bevy | rtgc |
|---|---|
| 0.18 | 0.3 |
| 0.17 | 0.2 |