I have Boost 1.42 and Threadpool 0.25 installed. When I use _CrtDumpMemoryLeaks(); at the end of my program, I get a lot of memory leaks, even when I have just a hello world application, which looks like this:
To get this code to work, you need to include the directories to boost and to threadpool (e.g. C:\Program Files (x86)\boost\boost_1_42 and C:\Program Files (x86)\boost\boost_1_42\threadpool\boost) as well as the boost library (e.g. C:\Program Files (x86)\boost\boost_1_42\lib) in your project settings.
Even within this small application I get about a dozen memory leaks. Am I doing something wrong or is this a threadpool issue?
"boost.threadpool" is an experimental library in early stage of development. It is not a part of boost yet (e.g. you won't find it on http://www.boost.org/doc/libs/ ).
I've installed threadpool 0.2.5 from http://threadpool.sourceforge.net/index.html on my linux dev system and confirm the leak: the thread pool that is created by thread_pool's constructor is not deleted by thread_pool's destructor. On quick glance, they are misusing shared_ptr (pool_core remains alive with use_count() > 1 after pool's dtor finishes).
PS: it makes no difference with regards to the problem, but why are you using new in this program?
PS/2: I use boost.asio when I need a persistent thread pool.
Thank you for the quick response, Cubbi. That helps a lot.
There was no real reason on why I called new. I guess I just wanted to have that feeling of safely knowing that my "tp" is nothing more than a null-pointer by the time my program ended. I just preferred manual deletion via "delete" over automatic deletion at the end of the app, so I had more control on everything concerning Threadpool.
I haven't heard of Asio before. I'll try it out next. Thanks for the hint.