aboutsummaryrefslogtreecommitdiffstats
path: root/gc.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-12-17 13:25:35 -0800
committerAaron Patterson <tenderlove@ruby-lang.org>2020-12-17 13:26:53 -0800
commit895b10ad020a788566c6e35431d07e6121e38c87 (patch)
tree41b4a51566e9d196439a4b90bc115a65fa910230 /gc.rb
parent81739ad4fdfcc86a769056fec352f27c686fba1b (diff)
downloadruby-895b10ad020a788566c6e35431d07e6121e38c87.tar.gz
Add documentation about GC.compact
[Misc #16443][ruby-core:96395]
Diffstat (limited to 'gc.rb')
-rw-r--r--gc.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gc.rb b/gc.rb
index 4e0faaf00d..8a00b406ce 100644
--- a/gc.rb
+++ b/gc.rb
@@ -198,6 +198,17 @@ module GC
Primitive.gc_compact_stats
end
+ # call-seq:
+ # GC.compact
+ #
+ # This function compacts objects together in Ruby's heap. It eliminates
+ # unused space (or fragmentation) in the heap by moving objects in to that
+ # unused space. This function returns a hash which contains statistics about
+ # which objects were moved. See `GC.latest_gc_info` for details about
+ # compaction statistics.
+ #
+ # This method is implementation specific and not expected to be implemented
+ # in any implementation besides MRI.
def self.compact
Primitive.gc_compact
end