class method
GC.stress=
(::Integer flag) -> ::Integer
(bool flag) -> bool
GC.stress = value → value
gc.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/gc.rb, line 111
def self.stress=(flag)
Primitive.gc_stress_set_m flag
end
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
nilorfalse, 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.