Define GIGACAGE_ALLOCATION_CAN_FAIL on Linux
[WebKit-https.git] / Source / bmalloc / bmalloc / Gigacage.h
index 027e280..7839f86 100644 (file)
 #define GIGACAGE_ALLOCATION_CAN_FAIL 0
 #endif
 
+// In Linux, if `vm.overcommit_memory = 2` is specified, mmap with large size can fail if it exceeds the size of RAM.
+// So we specify GIGACAGE_ALLOCATION_CAN_FAIL = 1.
+#if BOS(LINUX)
+#undef GIGACAGE_ALLOCATION_CAN_FAIL
+#define GIGACAGE_ALLOCATION_CAN_FAIL 1
+#endif
+
 static_assert(bmalloc::isPowerOfTwo(PRIMITIVE_GIGACAGE_SIZE), "");
 static_assert(bmalloc::isPowerOfTwo(JSVALUE_GIGACAGE_SIZE), "");