rust_cc

Module config

Source
Available on crate feature auto-collect only.
Expand description

Configuration of the garbage collector.

The configuration can be accessed using the config function.

§Automatic collection executions

Collections can be automatically started if auto_collect is set to true.

To determine whether to start a collection, a threshold is kept over the number of allocated bytes. When calling a function which may start a collection (e.g. Cc::new), if the number of allocated bytes exceeds the threshold a collection is started.

At the end of the automatically started collection, if the threshold is still lower than the number of allocated bytes then it is doubled until it exceed it.

Instead, if the number of allocated bytes exceed the threshold multiplied by the adjustment_percent, then the threshold is halved until the condition becomes true.

Finally, a collection may also happen if the number of objects buffered to be processed in the next collection (see Cc::mark_alive) exceeds the buffered_objects_threshold. This parameter is disabled by default, but can be enabled by using set_buffered_objects_threshold.

Structs§

  • The configuration of the garbage collector.

Enums§

Functions§

  • Access the configuration.