[Boost-bugs] [Boost C++ Libraries] #10651: boost::thread leaks memory when using the MinGW compiler

Subject: [Boost-bugs] [Boost C++ Libraries] #10651: boost::thread leaks memory when using the MinGW compiler
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-12 09:26:55


#10651: boost::thread leaks memory when using the MinGW compiler
------------------------------+----------------------
 Reporter: michael.burr@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------
 boost::thread leaks memory when using the MinGW compiler

 This report is based on information originally from:

     [hxxp://stackoverflow.com/questions/26284056/threads-hogging-up-
 memory]

 When the following program is compiled with MinGW, the memory use of the
 process continually increases:

 {{{
 #include <boost/thread.hpp>

 void thread_func()
 {
     return;
 }

 int main()
 {
     for (;;) {
         boost::thread t1(thread_func);
         boost::thread t2(thread_func);

         t1.join();
         t2.join();
     }
 }

 }}}

 Any one of the following changes to the program seem to make the memory
 leak go away:

   - add a call to the Windows API `Sleep(1)` to `thread_func()`
   - use only a single thread
   - move the call to `t1.join()` to before the creation of `t2`

 I'm not sure if this problem is sensitive to the version of MinGW. I used
 MinGW 4.8.1 from tdm-gcc:

     [hxxp://tdm-gcc.tdragon.net/]

 I built a 32-bit program; I'm not sure if a 64-bit program would behave
 differently.

 The problem doesn't occur when MSVC 12 (Visual Studio 2013) is used.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10651>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC