diff options
author | Aaron Patterson <[email protected]> | 2020-11-02 14:40:29 -0800 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2020-11-02 14:42:48 -0800 |
commit | 67b2c21c327c96d80b8a0fe02a96d417e85293e8 () | |
tree | c4ea1236016fc2b7e40582a69966d35c5f8c7289 /gc.rb | |
parent | 79b242260bc0530503dde85eda8e79b1c2aa9a6e (diff) |
Add `GC.auto_compact= true/false` and `GC.auto_compact`
* `GC.auto_compact=`, `GC.auto_compact` can be used to control when compaction runs. Setting `auto_compact=` to true will cause compaction to occurr duing major collections. At the moment, compaction adds significant overhead to major collections, so please test first! [Feature #17176]
-rw-r--r-- | gc.rb | 56 |
1 files changed, 51 insertions, 5 deletions
@@ -31,11 +31,32 @@ module GC # are not guaranteed to be future-compatible, and may be ignored if the # underlying implementation does not support them. def self.start full_mark: true, immediate_mark: true, immediate_sweep: true - Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep end def garbage_collect full_mark: true, immediate_mark: true, immediate_sweep: true - Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep end # call-seq: @@ -163,8 +184,23 @@ module GC Primitive.gc_latest_gc_info hash_or_key end def self.compact - Primitive.rb_gc_compact end # call-seq: @@ -182,13 +218,23 @@ module GC # 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) - Primitive.gc_verify_compaction_references(toward, double_heap) end end module ObjectSpace def garbage_collect full_mark: true, immediate_mark: true, immediate_sweep: true - Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep end module_function :garbage_collect |