-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[DOC] Tweaks for GC.config #14137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[DOC] Tweaks for GC.config #14137
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,71 +250,59 @@ def self.stat_heap heap_name = nil, hash_or_key = nil | |
|
||
# call-seq: | ||
# GC.config -> hash | ||
# GC.config(hash) -> hash | ||
# GC.config(hash_to_merge) -> merged_hash | ||
# | ||
# Sets or gets information about the current \GC config. | ||
# This method is implementation-specific to CRuby. | ||
# | ||
# Configuration parameters are \GC implementation-specific and may change | ||
# without notice. | ||
# Sets or gets information about the current \GC configuration. | ||
# | ||
# This method can be called without parameters to retrieve the current config | ||
# as a +Hash+ with +Symbol+ keys. | ||
# Configuration parameters are \GC implementation-specific and may change without notice. | ||
# | ||
# This method can also be called with a +Hash+ argument to assign values to | ||
# valid config keys. Config keys missing from the passed +Hash+ will be left | ||
# unmodified. | ||
# With no argument given, returns a hash containing the configuration: | ||
# | ||
# If a key/value pair is passed to this function that does not correspond to | ||
# a valid config key for the \GC implementation being used, no config will be | ||
# updated, the key will be present in the returned Hash, and its value will | ||
# be +nil+. This is to facilitate easy migration between \GC implementations. | ||
# GC.config | ||
# # => {rgengc_allow_full_mark: true, implementation: "default"} | ||
# | ||
# In both call-seqs, the return value of <code>GC.config</code> will be a +Hash+ | ||
# containing the most recent full configuration, i.e., all keys and values | ||
# defined by the specific \GC implementation being used. In the case of a | ||
# config update, the return value will include the new values being updated. | ||
# With argument +hash_to_merge+ given, | ||
# merges that hash into the stored configuration hash; | ||
# ignores unknown hash keys; | ||
# returns the implementation-specific configuration hash (see below): | ||
# | ||
# This method is only expected to work on CRuby. | ||
# | ||
# === \GC Implementation independent values | ||
# | ||
# The <code>GC.config</code> hash can also contain keys that are global and | ||
# read-only. These keys are not specific to any one \GC library implementation | ||
# and attempting to write to them will raise +ArgumentError+. | ||
# | ||
# There is currently only one global, read-only key: | ||
# GC.config(rgengc_allow_full_mark: false) | ||
# # => {rgengc_allow_full_mark: false} | ||
# GC.config | ||
# # => {rgengc_allow_full_mark: false, implementation: "default"} | ||
# GC.config(foo: 'bar') | ||
# # => {rgengc_allow_full_mark: false} | ||
# GC.config | ||
# # => {rgengc_allow_full_mark: false, implementation: "default"} | ||
# | ||
# [implementation] | ||
# Returns a +String+ containing the name of the currently loaded \GC library, | ||
# if one has been loaded using +RUBY_GC_LIBRARY+, and "default" in all other | ||
# cases | ||
# <b>All-Implementations Configuration</b> | ||
# | ||
# === \GC Implementation specific values | ||
# The single read-only entry for all implementations is: | ||
# | ||
# \GC libraries are expected to document their own configuration. Valid keys | ||
# for Ruby's default \GC implementation are: | ||
# - +implementation+: | ||
# the string name of the implementation; | ||
# for the Ruby default implementation, <tt>'default'</tt>. | ||
# | ||
# [rgengc_allow_full_mark] | ||
# Controls whether the \GC is allowed to run a full mark (young & old objects). | ||
# <b>Implementation-Specific Configuration</b> | ||
# | ||
# When +true+, \GC interleaves major and minor collections. This is the default. \GC | ||
# will function as intended. | ||
# A \GC implementation maintains its own implementation-specific configuration. | ||
# | ||
# When +false+, the \GC will never trigger a full marking cycle unless | ||
# explicitly requested by user code. Instead, only a minor mark will run— | ||
# only young objects will be marked. When the heap space is exhausted, new | ||
# pages will be allocated immediately instead of running a full mark. | ||
# For Ruby's default implementation the single entry is: | ||
# | ||
# A flag will be set to notify that a full mark has been | ||
# requested. This flag is accessible using | ||
# <code>GC.latest_gc_info(:need_major_by)</code> | ||
Comment on lines
-308
to
-310
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is useful information we should keep. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restored (with slight reorganization). |
||
# - +rgengc_allow_full_mark+: | ||
# Controls whether the \GC is allowed to run a full mark (young & old objects): | ||
# | ||
# The user can trigger a major collection at any time using | ||
# <code>GC.start(full_mark: true)</code> | ||
# - +true+ (default): \GC interleaves major and minor collections. | ||
# A flag is set to notify GC that a full mark has been requested. | ||
# This flag is accessible via GC.latest_gc_info(:need_major_by). | ||
# - +false+: \GC does not initiate a full marking cycle unless explicitly directed by user code; | ||
# see GC.start. | ||
# Setting this parameter to +false+ disables young-to-old promotion. | ||
# For performance reasons, we recommended warming up the application using Process.warmup | ||
# before setting this parameter to +false+. | ||
# | ||
# When +false+, Young to Old object promotion is disabled. For performance | ||
# reasons, it is recommended to warm up an application using +Process.warmup+ | ||
# before setting this parameter to +false+. | ||
def self.config hash = nil | ||
return Primitive.gc_config_get unless hash | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep this. Ruby now allows alternate GC implementation, and the parameters specified here may not apply to a different implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored.