class IdleGC::Timer
- IdleGC::Timer
- Reference
- Object
Defined in:
idle-gc/timer.crConstant Summary
-
DEFAULT_BYTES_SINCE_GC_THRESHOLD =
0_u64
-
DEFAULT_FORCE_GC_PERIOD =
2.minutes
-
DEFAULT_POLL_INTERVAL =
1.second
Class Method Summary
-
.bytes_since_gc_threshold=(v : UInt64) : Nil
Set to the minimum number of allocated memory bytes required to trigger a collection.
-
.force_gc_period=(v : Time::Span | Nil) : Nil
Set the force GC period, which forces a GC run when non-idle.
-
.poll_interval=(v : Time::Span) : Nil
Set the polling interval.
-
.start : Nil
Start a background Fiber that runs garbage collection periodically.
-
.stop : Nil
Stop periodic garbage collection.
Class Method Detail
Set to the minimum number of allocated memory bytes required to trigger a collection.
Default is 0, meaning that any allocated memory will trigger a collection.
Set the force GC period, which forces a GC run when non-idle.
Set to nil to disable this behavior.
Defaults to 2 minutes.
Set the polling interval.
Polling more frequently will keep memory usage lower, but will burn more CPU time on garbage collection.
The sweet spot is probably seconds to minutes.
Start a background Fiber that runs garbage collection periodically.
(Also runs garbage collection immediately.)
Stop periodic garbage collection. Used for testing.
(You don't need to call this. Just let IdleGC die naturally when your program exits.)