Boost C++ Libraries: Ticket #3274: Boost::sherad_ptr crash when used in stl queue https://svn.boost.org/trac10/ticket/3274 <p> Hi, We have a scenario where we are storing instances of boost::shared_ptr in a stl queue. Then we pop the data out of Queue and do further processing. If i am correct then the pop() provided by stl queue calls the destructor of the object being popped out(which in this case would be boost::shared_ptr instance). This happens in a continuous daemon process which crashes at some random point say after 6 or 8 hrs because of boost pointer corruption. Am provding a small template below as per our implementation. </p> <p> boost::shared_ptr&lt;Sample&gt; spSample; spSample.reset(new Sample()) ; </p> <p> queue.push(spSample) ; </p> <p> <em>The below processing happens in a thread. No object is being shared between threads. Each thread has its own stl queue into which the data is pumped in by parent thread as shown above. boost::shared_ptr&lt;Sample&gt; spSample1 = q.front() ; q.pop() ; </em> Will call the destructor of the shared_ptr at q.front() </p> <p> <em>some function called which takes spSample1 as paramater func(spSample1) ; </em></p> <p> Is it safe to use boost::shared_ptr with stl queue ?? </p> <p> We are using version 1.33.1. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3274 Trac 1.4.3 Steven Watanabe Fri, 17 Jul 2009 16:27:16 GMT status, component changed; resolution set https://svn.boost.org/trac10/ticket/3274#comment:1 https://svn.boost.org/trac10/ticket/3274#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> <li><strong>component</strong> <span class="trac-field-old">Regression Testing</span> → <span class="trac-field-new">smart_ptr</span> </li> </ul> <p> Duplicates <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3272" title="#3272: Bugs: Boost::shared_ptr crash when used in stl queue (closed: invalid)">#3272</a>. </p> Ticket