diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-08-14 14:04:55 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-08-15 08:54:27 -0400 |
commit | 2498140777020808a007691516e7bf8d8d862215 (patch) | |
tree | d198d62e62e34e48dc4cd225c3c18a3306640f59 /gc.rb | |
parent | 300bc145892488b91f10438f06fe75d03809424c (diff) |
[DOC] Improve docs for GC.start
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8219
Diffstat (limited to 'gc.rb')
-rw-r--r-- | gc.rb | 45 |
1 files changed, 25 insertions, 20 deletions
@@ -10,26 +10,31 @@ # GC::Profiler. module GC - # call-seq: - # GC.start -> nil - # ObjectSpace.garbage_collect -> nil - # include GC; garbage_collect -> nil - # GC.start(full_mark: true, immediate_sweep: true) -> nil - # ObjectSpace.garbage_collect(full_mark: true, immediate_sweep: true) -> nil - # include GC; garbage_collect(full_mark: true, immediate_sweep: true) -> nil - # - # Initiates garbage collection, even if manually disabled. - # - # This method is defined with keyword arguments that default to true: - # - # def GC.start(full_mark: true, immediate_sweep: true); end - # - # Use full_mark: false to perform a minor \GC. - # Use immediate_sweep: false to defer sweeping (use lazy sweep). - # - # Note: These keyword arguments are implementation and version dependent. They - # are not guaranteed to be future-compatible, and may be ignored if the - # underlying implementation does not support them. + # Initiates garbage collection, even if manually disabled. + # + # The +full_mark+ keyword argument determines whether or not to perform a + # major garbage collection cycle. When set to +true+, a major garbage + # collection cycle is ran, meaning all objects are marked. When set to + # +false+, a minor garbage collection cycle is ran, meaning only young + # objects are marked. + # + # The +immediate_mark+ keyword argument determines whether or not to perform + # incremental marking. When set to +true+, marking is completed during the + # call to this method. When set to +false+, marking is performed in steps + # that is interleaved with future Ruby code execution, so marking might not + # be completed during this method call. Note that if +full_mark+ is +false+ + # then marking will always be immediate, regardless of the value of + # +immediate_mark+. + # + # The +immedate_sweep+ keyword argument determines whether or not to defer + # sweeping (using lazy sweep). When set to +true+, sweeping is performed in + # steps that is interleaved with future Ruby code execution, so sweeping might + # not be completed during this method call. When set to +false+, sweeping is + # completed during the call to this method. + # + # Note: These keyword arguments are implementation and version dependent. They + # are not guaranteed to be future-compatible, and may be ignored if the + # underlying implementation does not support them. def self.start full_mark: true, immediate_mark: true, immediate_sweep: true Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep, false end |