summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-02-23 16:29:53 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2021-02-25 11:01:50 -0800
commit1c0e79e87b202ac707833fb1bd5e9398c8d0b4fb (patch)
tree36378b3c5551655e60014743a2bcf760ee2df488 /gc.c
parent1e13548953659bd12c28625d45998322449f3be8 (diff)
Disable auto compaction on platforms that do not support it
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4227
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 2a0fa800c1..d1a9174fae 100644
--- a/gc.c
+++ b/gc.c
@@ -9986,6 +9986,13 @@ gc_set_auto_compact(rb_execution_context_t *ec, VALUE _, VALUE v)
rb_raise(rb_eNotImpError, "Automatic compaction isn't available on this platform");
}
#endif
+
+ /* If not MinGW, Windows, or does not have mmap, we cannot use mprotect for
+ * the read barrier, so we must disable automatic compaction. */
+#if !defined(__MINGW32__) && !defined(_WIN32) && !defined(HAVE_MMAP)
+ rb_raise(rb_eNotImpError, "Automatic compaction isn't available on this platform");
+#endif
+
ruby_enable_autocompact = RTEST(v);
return v;
}