From 1985e9d11c9cf409a935e648480bd275214adc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 14 Apr 2010 08:00:29 +0200 Subject: MacOS X: Boost default stack size The default stack size on MacOS X for the SMP emulator is too small to support all uses of pcre. For example, the following expression N = 819, re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]). will cause a stack overflow. By bisection of different values for the +sss option, I found that 166 is the smallest value that avoids the crash. Round that up to 256 to give a nice, round power of 2 and a resonable safety margin. Use that value as a default stack size on MacOS X only. --- erts/emulator/beam/erl_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'erts/emulator/beam') diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index e97ab328cd..41cfcd74aa 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -819,7 +819,13 @@ erl_start(int argc, char **argv) if (erts_sys_getenv("ERL_THREAD_POOL_SIZE", envbuf, &envbufsz) == 0) { async_max_threads = atoi(envbuf); } - + +#if (defined(__APPLE__) && defined(__MACH__)) || defined(__DARWIN__) + /* + * The default stack size on MacOS X is too small for pcre. + */ + erts_sched_thread_suggested_stack_size = 256; +#endif #ifdef DEBUG verbose = DEBUG_DEFAULT; -- cgit v1.2.3