Additional information:

Another example attached.
On line #54 there is an #if directive. If I put an #if 0 there, the function 
ThreadProc() would get directly called - hence would run in the same thread 
with main() - and I got the following result:

E:\Desktop>g++ test2.cpp -static -std=c++11

E:\Desktop>a
ctor : global cnt = 0
exception caught, e = 12345
dtor : global cnt = 5

On the other hand, if I left it #if 1 there, the program would throw an 
exception in another thread, catch it and rethrow it in the main thread, and I 
got the following result:

E:\Desktop>g++ test2.cpp -static -std=c++11

E:\Desktop>a
ctor : global cnt = 0
exception caught, e = 12345
dtor : global cnt = 6

AFAIK mingw-w64 uses callbacks to reclaim TLS memory. In the first case, upon 
destruction of the static object there were 5 blocks of memory unfreed; and in 
the second case there were 6. If we say there was no memory leak in case 1, 
then there must be in case 2, IMO.

2014-01-17
lh_mouse

Attachment: test2.cpp
Description: Binary data

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to