summaryrefslogtreecommitdiff
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-24 12:25:30 -0800
commita80366c922c5ad3ce27870d92ffbec5ce292ec31 (patch)
tree946695d212234fe8d2d9c3da831f01cc3312b6a8
parent785f5eb8f0f994c755ac5f1e1479f6e2ec6d0ef3 (diff)
Disable auto compaction on platforms that do not support it
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4221
-rw-r--r--gc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index daffb8e4fe..073d1bc7df 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;
}