Mercurial > cpython-lru_cache-weakref
diff Python/thread_pthread.h @ 75596:246e681a4272 3.2
Issue #14184: Increase the default stack size for secondary threads on
Mac OS X to prevent interpreter crashes when compiled on 10.7.
| author | Ned Deily <nad@acm.org> |
|---|---|
| date | Tue, 13 Mar 2012 11:18:18 -0700 |
| parents | 8a484090da7e |
| children | 280469ce6669 c00ac2b25048 |
line wrap: on
line diff
--- a/Python/thread_pthread.h Tue Mar 13 12:18:19 2012 +0000 +++ b/Python/thread_pthread.h Tue Mar 13 11:18:18 2012 -0700 @@ -19,14 +19,18 @@ #define THREAD_STACK_SIZE 0 /* use default stack size */ #endif -#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 - /* The default stack size for new threads on OSX is small enough that - * we'll get hard crashes instead of 'maximum recursion depth exceeded' - * exceptions. - * - * The default stack size below is the minimal stack size where a - * simple recursive function doesn't cause a hard crash. - */ +/* The default stack size for new threads on OSX and BSD is small enough that + * we'll get hard crashes instead of 'maximum recursion depth exceeded' + * exceptions. + * + * The default stack sizes below are the empirically determined minimal stack + * sizes where a simple recursive function doesn't cause a hard crash. + */ +#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 +#undef THREAD_STACK_SIZE +#define THREAD_STACK_SIZE 0x500000 +#endif +#if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 #undef THREAD_STACK_SIZE #define THREAD_STACK_SIZE 0x400000 #endif
