Hello,
After some sleep I understood what you wrote, sorry about that, I need to get ride of habit of posting after 12h of coding, can't think straight.
Yes You are right that mingw (actually mingwm10, and so on, dll's) probably can't be statical compiled (I don't count trick to load dll from resource, so only one exe is deployed). But, and that's why I misunderstood You in the first place, You really don't need i.e. mingwm10.dll for Release build (they are not linked at all).
In short this dll handle exceptions and clean up after threads, but AFAIK, reference: http://old.nabble.com/mingwm10.dll-ts8920679.html , using:
configure -static -release -no-exceptions
configure -static -release -no-exceptions
To copy to clipboard, switch view to plain text mode
prevent linker from linking it ( -no-exceptions ). Also, on posted thread, they are saying that mingwm10.dll clean up after threads, to prevent memory leak (24 * sizeof (void*) = 96byte, second post, and yes I know that thread was started in 2007 so probably information are outdated) for each catch in thread. So to summ it up, if no exceptions are used and no -mthreads is passed at compile time no need for mingwm10. (maybe I'm wrong?)
I wrote small test app, to see if something strange is going on with QThreads on static build, like mem leek and so on.
stat_test_dyn.exe (dynamic release build, require all dll like mingwm, QCore4 ...)
qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
mingw32-make.exe -w in \stat_test
objdump.exe -j .idata -p stat_test_dyn.exe | sed -ne '/mingwm10/,/^$/{p;}'
DLL Name: mingwm10.dll
vma: Hint/Ord Member-Name Bound-To
qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
mingw32-make.exe -w in \stat_test
objdump.exe -j .idata -p stat_test_dyn.exe | sed -ne '/mingwm10/,/^$/{p;}'
DLL Name: mingwm10.dll
vma: Hint/Ord Member-Name Bound-To
To copy to clipboard, switch view to plain text mode
stat_test_static.exe (static release build, don't require all dll like mingwm, QCore4 ...)
qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
mingw32-make.exe -w in \stat_test
objdump.exe -j .idata -p stat_test_static.exe | sed -ne '/mingwm10/,/^$/{p;}'
no output
qmake.exe stat_test.pro -spec win32-g++ -r CONFIG+=release
mingw32-make.exe -w in \stat_test
objdump.exe -j .idata -p stat_test_static.exe | sed -ne '/mingwm10/,/^$/{p;}'
no output
To copy to clipboard, switch view to plain text mode
Program run 1000 times thread, one after another, and output values to progressbar (from 0 -> 100 ).
I run it ten times, so assuming mem leak of 96bytes on each thread * 1000 * 10 = 937KB mem leek.
statistics for stat_test_dyn.exe [DYNAMIC]
dyn_Snap1..jpgdyn_Snap2..jpg
after 10 runs mem usage is higher by168KB.
statistics for stat_test_static.exe [STATIC]
static_Snap1..jpgstatic_Snap2..jpg
after 10 runs mem usage is higher by120KB.
To sum it up 10000 thread's executed one after another. Test machine Windows XP SP3 32bit. Process Explorer v 11.33.
In attachment is src code if someone would want to test this by itself.
Of course there can be some error made by me, so you are welcome to point them out. stat_tst..zip
Bookmarks