Add documentation about GC.compact

[Misc #16443][ruby-core:96395]
This commit is contained in:
Aaron Patterson 2020-12-17 13:25:35 -08:00
Родитель 81739ad4fd
Коммит 895b10ad02
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 953170BCB4FFAFC6
1 изменённых файлов: 11 добавлений и 0 удалений

11
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