@@ -258,71 +258,58 @@ def self.stat_heap heap_name = nil, hash_or_key = nil
258258
259259 # call-seq:
260260 # GC.config -> hash
261- # GC.config(hash ) -> hash
261+ # GC.config(hash_to_merge ) -> merged_hash
262262 #
263- # Sets or gets information about the current \GC config.
263+ # This method is expected to be defined, useful, and well-behaved
264+ # only in the CRuby implementation.
264265 #
265- # Configuration parameters are \GC implementation-specific and may change
266- # without notice.
266+ # Sets or gets information about the current \GC configuration.
267267 #
268- # This method can be called without parameters to retrieve the current config
269- # as a +Hash+ with +Symbol+ keys.
268+ # With no argument given, returns a hash containing the configuration:
270269 #
271- # This method can also be called with a +Hash+ argument to assign values to
272- # valid config keys. Config keys missing from the passed +Hash+ will be left
273- # unmodified.
270+ # GC.config
271+ # # => {rgengc_allow_full_mark: true, implementation: "default"}
274272 #
275- # If a key/value pair is passed to this function that does not correspond to
276- # a valid config key for the \GC implementation being used, no config will be
277- # updated, the key will be present in the returned Hash, and its value will
278- # be +nil+. This is to facilitate easy migration between \GC implementations.
273+ # With argument +hash_to_merge+ given,
274+ # merges that hash into the stored configuration hash;
275+ # ignores unknown hash keys;
276+ # returns the implementation-specific configuration hash (see below):
279277 #
280- # In both call-seqs, the return value of <code>GC.config</code> will be a +Hash+
281- # containing the most recent full configuration, i.e., all keys and values
282- # defined by the specific \GC implementation being used. In the case of a
283- # config update, the return value will include the new values being updated.
278+ # GC.config(rgengc_allow_full_mark: false)
279+ # # => {rgengc_allow_full_mark: false}
280+ # GC.config
281+ # # => {rgengc_allow_full_mark: false, implementation: "default"}
282+ # GC.config(foo: 'bar')
283+ # # => {rgengc_allow_full_mark: false}
284+ # GC.config
285+ # # => {rgengc_allow_full_mark: false, implementation: "default"}
284286 #
285- # This method is only expected to work on CRuby.
286- #
287- # === \GC Implementation independent values
288- #
289- # The <code>GC.config</code> hash can also contain keys that are global and
290- # read-only. These keys are not specific to any one \GC library implementation
291- # and attempting to write to them will raise +ArgumentError+.
287+ # <b>All-Implementations Configuration</b>
292288 #
293- # There is currently only one global, read-only key :
289+ # The single read- only entry for all implementations is :
294290 #
295- # [implementation]
296- # Returns a +String+ containing the name of the currently loaded \GC library,
297- # if one has been loaded using +RUBY_GC_LIBRARY+, and "default" in all other
298- # cases
291+ # - +implementation+:
292+ # the string name of the implementation;
293+ # for the Ruby default implementation, <tt>'default'</tt>.
299294 #
300- # === \GC Implementation specific values
295+ # <b> Implementation-Specific Configuration</b>
301296 #
302- # \GC libraries are expected to document their own configuration. Valid keys
303- # for Ruby's default \GC implementation are:
297+ # A \GC implementation maintains its own implementation-specific configuration.
304298 #
305- # [rgengc_allow_full_mark]
306- # Controls whether the \GC is allowed to run a full mark (young & old objects).
299+ # For Ruby's default implementation the single entry is:
307300 #
308- # When +true+, \GC interleaves major and minor collections. This is the default. \GC
309- # will function as intended.
301+ # - +rgengc_allow_full_mark+:
302+ # Controls whether the \GC is allowed to run a full mark (young & old objects):
310303 #
311- # When +false+, the \GC will never trigger a full marking cycle unless
312- # explicitly requested by user code. Instead, only a minor mark will run—
313- # only young objects will be marked. When the heap space is exhausted, new
314- # pages will be allocated immediately instead of running a full mark .
304+ # - +true+ (default): \GC interleaves major and minor collections.
305+ # - +false+: \GC does not initiate a full marking cycle unless
306+ # explicitly directed by user code;
307+ # see GC.start .
315308 #
316- # A flag will be set to notify that a full mark has been
317- # requested. This flag is accessible using
318- # <code>GC.latest_gc_info(:need_major_by)</code>
319- #
320- # The user can trigger a major collection at any time using
321- # <code>GC.start(full_mark: true)</code>
322- #
323- # When +false+, Young to Old object promotion is disabled. For performance
324- # reasons, it is recommended to warm up an application using +Process.warmup+
309+ # Setting this parameter to +false+ disables young-to-old promotion .
310+ # For performance reasons, we recommended warming up the application using Process.warmup
325311 # before setting this parameter to +false+.
312+ #
326313 def self . config hash = nil
327314 return Primitive . gc_config_get unless hash
328315
0 commit comments