diff options
author | eileencodes <eileencodes@gmail.com> | 2021-06-22 13:43:18 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2021-06-23 10:03:09 -0700 |
commit | 8209b735807d449c0a870562ee240585127ee100 (patch) | |
tree | 7a113ac65fb1a469d0a4ea7b99f920f1fd1966d7 /ractor.c | |
parent | 2fb435b3ab19bab644083c6eaf7ff06ce5b01841 (diff) |
Evacuate transient heap when enabling ractors
If the GC has been disabled we need to re-enable it so we can evacuate
the transient heap.
Fixes https://bugs.ruby-lang.org/issues/17985
[Bug #17985] [ruby-core:104260]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4596
Diffstat (limited to 'ractor.c')
-rw-r--r-- | ractor.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1420,9 +1420,15 @@ cancel_single_ractor_mode(void) // enable multi-ractor mode RUBY_DEBUG_LOG("enable multi-ractor mode", 0); + VALUE was_disabled = rb_gc_enable(); + rb_gc_start(); rb_transient_heap_evacuate(); + if (was_disabled) { + rb_gc_disable(); + } + ruby_single_main_ractor = NULL; if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) { |