sal/osl/unx/thread.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
New commits: commit 1844326df477eb379f281e6f027fc8e6475f28bf Author: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> AuthorDate: Wed Jul 20 17:42:30 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Jul 20 21:52:52 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 <sberg...@redhat.com> diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index 54e674dd4de5..b122c5f31f3f 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -280,7 +280,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 @@ -296,14 +296,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); @@ -313,7 +315,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, @@ -331,7 +333,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