Skip to content

Commit 4af7d6f

Browse files
authored
Disabling threads on apple's hardware when optimizer is turned off (simdjson#692)
* Disabling threads on apple's hardware. * Turns out that you can have your bread, your butter and you cake too!
1 parent 0fd159d commit 4af7d6f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

include/simdjson/portability.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@
8181
#define SIMDJSON_THREADS_ENABLED
8282
#endif
8383

84+
85+
// workaround for large stack sizes under -O0.
86+
// https://github.com/simdjson/simdjson/issues/691
87+
#ifdef __APPLE__
88+
#ifndef __OPTIMIZE__
89+
// Apple systems have small stack sizes in secondary threads.
90+
// Lack of compiler optimization may generate high stack usage.
91+
// So we are disabling multithreaded support for safety.
92+
#undef SIMDJSON_THREADS_ENABLED
93+
#endif
94+
#endif
95+
8496
#if defined(__clang__)
8597
#define NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
8698
#elif defined(__GNUC__)

0 commit comments

Comments
 (0)