threadpool-0.2.5-memleak.patch 786 B

1234567891011121314151617181920212223
  1. Fix memleak due circular references blocking garbage collection.
  2. http://www.cplusplus.com/forum/general/56971/ provides a testcase for a memory
  3. leak with the threadpool due to shared_ptr usage.
  4. I really needed threadpool to work for me, so I traced & fixed it as best as
  5. possible. When the threadpool is being destroyed, your threads should have
  6. terminated already. Do so deliberately if not done yet, so that they free the
  7. memory.
  8. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
  9. --- threadpool/boost/threadpool/detail/pool_core.hpp
  10. +++ threadpool/boost/threadpool/detail/pool_core.hpp
  11. @@ -150,6 +150,7 @@
  12. /// Destructor.
  13. ~pool_core()
  14. {
  15. + terminate_all_workers(true);
  16. }
  17. /*! Gets the size controller which manages the number of threads in the pool.