title: How to delete boost thread object when thread itself terminates?
body: <p>When threads are added to boost::thread_group like:</p>
  
  <pre><code>boost::thread_group my_threads;
  boost::thread *t = new boost::thread( &amp;someFunc );
  my_threads.add_thread(th);
  </code></pre>
  
  <p>all the created boost::thread objects are deleted only when <code>my_threads</code> object is out of scope. But my program main thread spawns a lot of threads while execution. So if about 50 threads are already done, about <strong>1,5Gb</strong> of memory is used by program and this memory is freed only on main process termination.</p>
  
  <p>The question is: <strong>How to delete these boost::thread object when thread function is finished ?!</strong></p>