mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Moved GC.verify_compaction_references to gc.rb
And fixed a segfault by coercion of `Qundef`, when any keyword argument without `toward:` option is given.
This commit is contained in:
parent
9b55a9649f
commit
af899503a6
3 changed files with 25 additions and 45 deletions
18
gc.rb
18
gc.rb
|
|
@ -166,6 +166,24 @@ module GC
|
|||
def self.compact
|
||||
__builtin_rb_gc_compact
|
||||
end
|
||||
|
||||
# call-seq:
|
||||
# GC.verify_compaction_references(toward: nil, double_heap: nil) -> nil
|
||||
#
|
||||
# Verify compaction reference consistency.
|
||||
#
|
||||
# This method is implementation specific. During compaction, objects that
|
||||
# were moved are replaced with T_MOVED objects. No object should have a
|
||||
# reference to a T_MOVED object after compaction.
|
||||
#
|
||||
# This function doubles the heap to ensure room to move all objects,
|
||||
# compacts the heap to make sure everything moves, updates all references,
|
||||
# then performs a full GC. If any object contains a reference to a T_MOVED
|
||||
# object, that object should be pushed on the mark stack, and will
|
||||
# make a SEGV.
|
||||
def self.verify_compaction_references(toward: nil, double_heap: false)
|
||||
__builtin_gc_verify_compaction_references(toward, double_heap)
|
||||
end
|
||||
end
|
||||
|
||||
module ObjectSpace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue