summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-07-20 17:42:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-07-20 21:52:52 +0200
commit1844326df477eb379f281e6f027fc8e6475f28bf (patch)
tree7e819173deb1ac7627a03de19b3abbc9cbad74de /sal
parenteda0c48278da6549c01c9f0ce4f469249e420d63 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/thread.cxx12
1 files changed, 7 insertions, 5 deletions
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