IdleGC
IdleGC runs garbage collection during quiet periods between application work. Call IdleGC.start, then wrap requests or jobs in IdleGC.busy { ... }.
IdleGC.collect always collects. IdleGC.collect_if_needed checks allocations, and IdleGC.collect_if_needed_and_idle also checks for activity. Use IdleGC.background_collect to request a background attempt.
Constants
Class methods
Calling background_collect requests one background attempt by spinning up a new fiber. Returns false if one is already pending. A request near the end of an attempt may be missed; the periodic poll retries.
Mark activity without a block. Call again if the work outlasts the period.
Postpone idle collection until the block and its quiet period finish. This is the recommended interface for wrapping application work.
Collect if enough memory has been allocated and no tracked work is busy.
Relative to IdleGC::Time.monotonic, when did IdleGC last check whether or not to run garbage collect?
Returns nil if we've never checked.
Relative to IdleGC::Time.monotonic, when did IdleGC last initiate GC.collect?
Returns nil if we've never collected.
How long did GC.collect take to run?
Returns nil if we've never collected.
Minimum allocations for conditional collection. Defaults to 1 MiB. Setting this to zero still requires at least one allocated byte.