I am using a shared_ptr to execute code on method exit as instructed in http://www.boost.org/doc/libs/1_44_0/libs/smart_ptr/sp_techniques.html#on_bl...
shared_ptr<void> shutdown(static_cast(0), bind(&Thread::AnnounceShutdown, this, ref(state_lock)));
The above line of code causes a memory leak when an exception is thrown inside AnnounceShutdown(). I know I am not supposed to throw inside a destructor, but in this particular case I see no reason for a memory leak. AnnounceShutDown() does not allocate memory. I suspect ref() has something to do with that.
debugger report:
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 14928 at 0x00000000006E6FF0: 56 bytes ----------
Call Stack:
d:\program files\boost\boost_1_44_0\boost\smart_ptr\detail\shared_count.hpp (124): boost::detail::shared_count::shared_countboost::shared_mutex & __ptr64>,boost::_bi::list2,boost::reference_wrapperboost::shared_mutex & __ptr64>,boost::_bi::list2,boost::reference_wrapper