Details
-
Suggestion
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
4.8.7, 5.5.1
-
None
-
all versions of Mac OS X
Description
OS X provides no way to set the default stack size for threads (it is always 512k), whereas the main thread stack size (default is 8M) can be set by setrlimit().
QThreadPool provides no way to change the stack size from the default https://bugreports.qt.io/browse/QTBUG-2568.
This, and the fact that clang does not optimize stack usage as well as gcc does, may cause stack overflow in programs that would run very well on linux or windows. Computation-intensive applications are affected by this problem.
This patch does the same fix as in Chromium https://chromium.googlesource.com/chromium/src.git/+/master/base/threading/platform_thread_mac.mm#186, and gives the same behaviour as on Linux:
If the thread stack size is not set explicitely, it is set to at least the same value as the main thread.
patch is for Qt 4.8.7, but very easy to adapt for Qt 5.5.1 (apply to qtbase/src/corelib/thread/qthread_unix.cpp)
Attachments
Issue Links
- is replaced by
-
QTBUG-2568 QThreadPool: support setting stack size for threads in thread pool
- Closed