GC.start
# File tmp/rubies/ruby-4.0.0/gc.rb, line 43
def self.start full_mark: true, immediate_mark: true, immediate_sweep: true
Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep, false
end
Initiates garbage collection, even if explicitly disabled by GC.disable.
Keyword arguments:
-
full_mark: its boolean value determines whether to perform a major garbage collection cycle:-
true: initiates a major garbage collection cycle, meaning all objects (old and new) are marked. -
false: initiates a minor garbage collection cycle, meaning only young objects are marked.
-
-
immediate_mark: its boolean value determines whether to perform incremental marking:-
true: marking is completed before the method returns. -
false: marking is performed by parts, interleaved with program execution both before the method returns and afterward; therefore marking may not be completed before the return. Note that iffull_markisfalse, marking will always be immediate, regardless of the value ofimmediate_mark.
-
-
immediate_sweep: its boolean value determines whether to defer sweeping (using lazy sweep):-
true: sweeping is completed before the method returns. -
false: sweeping is performed by parts, interleaved with program execution both before the method returns and afterward; therefore sweeping may not be completed before the return.
-
Note that these keyword arguments are implementation- and version-dependent, are not guaranteed to be future-compatible, and may be ignored in some implementations.