sal/osl/unx/thread.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
New commits: commit ec8485dec71fe27908f25eaa3186af2d17215b64 Author: Christian Lohmaier <[email protected]> AuthorDate: Wed Jul 20 17:42:30 2022 +0200 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Jul 22 10:20:35 2022 +0200 tdf#141421 xml export: default stacksize for threads on macOS is too small libxslt usage means lots of recursion for the sample document and the default for non-main threads is 512kB, see https://developer.apple.com/library/archive/qa/qa1419/_index.html and contrary to linux it doesn't default to the value set via ulimit. https://docs.microsoft.com/en-us/windows/win32/procthread/thread-stack-size says default for Windows is 1MB, so use that as a new default. (on linux it effectively is 8MB via ulimit, if not specified it would default to 2MB for most architectures) Change-Id: I10bd25301b0aea83e5bbb0c2103a0dd47a7e0736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137269 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 1844326df477eb379f281e6f027fc8e6475f28bf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137191 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index ce5ece7c1d59..ff073ecddb00 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -279,7 +279,7 @@ static oslThread osl_thread_create_Impl ( short nFlags) { Thread_Impl* pImpl; -#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS) +#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS) pthread_attr_t attr; size_t stacksize; #endif @@ -295,14 +295,16 @@ static oslThread osl_thread_create_Impl ( pthread_mutex_lock (&(pImpl->m_Lock)); -#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS) +#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS) if (pthread_attr_init(&attr) != 0) return nullptr; #if defined OPENBSD stacksize = 262144; -#else +#elif !ENABLE_RUNTIME_OPTIMIZATIONS stacksize = 12 * 1024 * 1024; // 8MB is not enough for ASAN on x86-64 +#else + stacksize = 1 * 1024 * 1024; // macOS default for non-main threads (512kB) is not enough... #endif if (pthread_attr_setstacksize(&attr, stacksize) != 0) { pthread_attr_destroy(&attr); @@ -312,7 +314,7 @@ static oslThread osl_thread_create_Impl ( if ((nRet = pthread_create ( &(pImpl->m_hThread), -#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS) +#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS) &attr, #else PTHREAD_ATTR_DEFAULT, @@ -330,7 +332,7 @@ static oslThread osl_thread_create_Impl ( return nullptr; } -#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS) +#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS) pthread_attr_destroy(&attr); #endif
