Opened 9 years ago
Last modified 8 years ago
#49793 new defect
qt4/5: set default QThread thread stack size to a reasonable value
Reported by: | devernay (Frédéric Devernay) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.3.4 |
Keywords: | Cc: | michaelld (Michael Dickens), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), mkae (Marko Käning) | |
Port: | qt4-mac qt5-mac |
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. 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 (also proposed upstream https://bugreports.qt.io/browse/QTBUG-2568) 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.
This patch is for Qt 4.8, but Qt 5 is easy to fix the same way.
Attachments (1)
Change History (3)
Changed 9 years ago by devernay (Frédéric Devernay)
Attachment: | patch-qthread-stacksize.diff added |
---|
comment:1 Changed 9 years ago by devernay (Frédéric Devernay)
Also filed a specific Qt bug at https://bugreports.qt.io/browse/QTBUG-49607
patch default qthread stack size to get same behavior as linux