aboutsummaryrefslogtreecommitdiffstats
path: root/gc.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-01-15 10:20:19 +0900
committerKoichi Sasada <ko1@atdot.net>2020-01-15 10:20:19 +0900
commiteb4c86a698e1be9fa2a79f4edb1c891396e6074e (patch)
treea7cfcab844f3f842fc2e50e90f98362068b86aed /gc.rb
parent8c3efa494091e6e0001f4a708fb7568c242387b9 (diff)
downloadruby-eb4c86a698e1be9fa2a79f4edb1c891396e6074e.tar.gz
Add option hash doc for GC stats.
Add a description about optional hash objects for GC.stat and GC.latest_gc_info. [Bug #14408] The patch is provided by sho-h (Sho Hashimoto). Thank you so much.
Diffstat (limited to 'gc.rb')
-rw-r--r--gc.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gc.rb b/gc.rb
index fcfa48fbe1..a87f9185f9 100644
--- a/gc.rb
+++ b/gc.rb
@@ -140,6 +140,10 @@ module GC
# The contents of the hash are implementation specific and may be changed in
# the future.
#
+ # If the optional argument, hash, is given,
+ # it is overwritten and returned.
+ # This is intended to avoid probe effect.
+ #
# This method is only expected to work on C Ruby.
def self.stat hash_or_key = nil
__builtin_gc_stat hash_or_key
@@ -151,6 +155,10 @@ module GC
# GC.latest_gc_info(:major_by) -> :malloc
#
# Returns information about the most recent garbage collection.
+ #
+ # If the optional argument, hash, is given,
+ # it is overwritten and returned.
+ # This is intended to avoid probe effect.
def self.latest_gc_info hash_or_key = nil
__builtin_gc_latest_gc_info hash_or_key
end