summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2021-12-29 16:15:36 +0900
committerNobuyoshi Nakada <[email protected]>2021-12-29 20:53:43 +0900
commit002fa2859962f22de8afdbeece04966ea57b7da9 (patch)
tree1318dc584897b7bbd5f4b40a36a31e53a7df1011 /gc.c
parent239e71c0af79e0c4b91cc21e7dff44a6c282d7b1 (diff)
On 64bit macOS, enlarge heap pages to reduce mmap calls [Bug #18447]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5371
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 a5369c28f1..bbc5c40e90 100644
--- a/gc.c
+++ b/gc.c
@@ -847,8 +847,15 @@ typedef struct rb_objspace {
} rb_objspace_t;
+#if defined(__APPLE__) && defined(__LP64__) && !defined(HEAP_PAGE_ALIGN_LOG)
+/* for slow mmap: 64KiB */
+#define HEAP_PAGE_ALIGN_LOG 16
+#endif
+
+#ifndef HEAP_PAGE_ALIGN_LOG
/* default tiny heap size: 16KB */
#define HEAP_PAGE_ALIGN_LOG 14
+#endif
#define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
enum {
HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG),