Using Visual Studio 9, we have detected memory leaks when using the threadpool library. Unfortunately, we do not have the time right now to debug it for you, so I am posting this in the hopes that you can take a look and maybe it is a quick fix for you. Basically, this method:
static void create_and_attach(shared_ptr<pool_type> const & pool)
shared_ptr<worker_thread> worker(new worker_thread(pool));
worker->m_thread.reset(new boost::thread(bind(&worker_thread::run, worker)));
creates new worker threads. As best I can tell, this is where the memory is being leaked. It looks like the worker and/or the pool are not getting released properly. I looked through and see that you are using shared pointers, so maybe the reference count is not getting decremented properly. Again, I haven't had the time to look more closely at it. To reproduce, basically just use this code (run it from Visual Studio):
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
boost::threadpool::pool pool( 1 );
Please let me know if you need any clarification or additional information. Thanks!