Skip to content
class method

GC.stress=

(::Integer flag) -> ::Integer
(bool flag) -> bool
GC.stress = value → value

Enables or disables stress mode; enabling stress mode will degrade performance; it is only for debugging.

Sets the current GC stress mode to the given value:

  • If the value is nil or false, disables stress mode.

  • If the value is an integer, enables stress mode with certain flags; see below.

  • Otherwise, enables stress mode; GC is invoked at every GC opportunity: all memory and object allocations.

The flags are bits in the given integer:

  • 0x01: No major GC.

  • 0x02: No immediate sweep.

  • 0x04: Full mark after malloc/calloc/realloc.

See also .stress .total_time .stat_heap #garbage_collect also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0