Boost C++ Libraries: Ticket #3107: Error in allocation/dealocation of timers https://svn.boost.org/trac10/ticket/3107 <p> Function enqueue_timer from timer_queue.hpp allocate new timers with the following code: </p> <blockquote> <p> std::auto_ptr&lt;timer&lt;Handler&gt; &gt; new_timer( </p> <blockquote> <p> new timer&lt;Handler&gt;(time, handler, token)); </p> </blockquote> </blockquote> <p> and later this timer will be deallocated with asio_handler_deallocate. Solution: replace "new-based" allocation with asio_handler_allocate: </p> <blockquote> <p> typedef timer&lt;Handler&gt; timer_type; typedef handler_alloc_traits&lt;Handler, timer_type&gt; alloc_traits; raw_handler_ptr&lt;alloc_traits&gt; raw_ptr(handler); handler_ptr&lt;alloc_traits&gt; new_timer(raw_ptr, time, handler, token); </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3107 Trac 1.4.3 Dmitry Fri, 29 May 2009 10:23:50 GMT attachment set https://svn.boost.org/trac10/ticket/3107 https://svn.boost.org/trac10/ticket/3107 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bug.cpp</span> </li> </ul> <p> minimal test </p> Ticket Dmitry Fri, 29 May 2009 10:24:22 GMT attachment set https://svn.boost.org/trac10/ticket/3107 https://svn.boost.org/trac10/ticket/3107 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">timer_queue.hpp</span> </li> </ul> <p> patched timer_queue.hpp </p> Ticket anonymous Mon, 01 Jun 2009 19:06:57 GMT <link>https://svn.boost.org/trac10/ticket/3107#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3107#comment:1</guid> <description> <p> Nice one. I've been trying to track down the source of a crash while iterating through the timer_queue_. This might fix it then. Cheers! Alex </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sat, 27 Jun 2009 05:25:16 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/3107#comment:2 https://svn.boost.org/trac10/ticket/3107#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Fixed on trunk in changeset <a class="changeset" href="https://svn.boost.org/trac10/changeset/54392" title="Fix custom memory allocation for timers. Ref #3107. ">[54392]</a>. </p> Ticket chris_kohlhoff Mon, 29 Jun 2009 13:36:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3107#comment:3 https://svn.boost.org/trac10/ticket/3107#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/54499" title="Merge from trunk. Fixes #3095, #3216, #3098, #3107, #1341, #2754, ...">[54499]</a>) Merge from trunk. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3095" title="#3095: Bugs: bug in automatic resizing of the bucket array (closed: fixed)">#3095</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3216" title="#3216: Bugs: variable shadowing with possibly bad implications (closed: fixed)">#3216</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3098" title="#3098: Bugs: Abort in boost::asio::ip::tcp::acceptor constructor on Mac OS X (closed: fixed)">#3098</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3107" title="#3107: Bugs: Error in allocation/dealocation of timers (closed: fixed)">#3107</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1341" title="#1341: Patches: unused argument and another g++ warning (closed: fixed)">#1341</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2754" title="#2754: Patches: [PATCH] building asio without exception support (closed: fixed)">#2754</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3157" title="#3157: Support Requests: ASIO Reference has no header file information (closed: fixed)">#3157</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2620" title="#2620: Bugs: Missing entries in documentation index (closed: fixed)">#2620</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2618" title="#2618: Bugs: Warnings about unused parameters with g++ -Wunused-parameter (closed: fixed)">#2618</a>. </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54373" title="Fix doc generation for array reference parameters. ">r54373</a> | chris_kohlhoff | 2009-06-26 21:03:14 +1000 (Fri, 26 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix doc generation for array reference parameters. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54376" title="Fix bug in hash resize. Ref #3095. ">r54376</a> | chris_kohlhoff | 2009-06-26 23:35:04 +1000 (Fri, 26 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix bug in hash resize. Ref <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3095" title="#3095: Bugs: bug in automatic resizing of the bucket array (closed: fixed)">#3095</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54377" title="Remove a local variable that was hiding the ec parameter and ...">r54377</a> | chris_kohlhoff | 2009-06-26 23:55:24 +1000 (Fri, 26 Jun 2009) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Remove a local variable that was hiding the ec parameter and preventing error codes from being correctly propagated. Ref <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3216" title="#3216: Bugs: variable shadowing with possibly bad implications (closed: fixed)">#3216</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54390" title="Fix failures reported when the tests are built with _GLIBCXX_DEBUG. ...">r54390</a> | chris_kohlhoff | 2009-06-27 12:17:49 +1000 (Sat, 27 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix failures reported when the tests are built with _GLIBCXX_DEBUG. Ref <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3098" title="#3098: Bugs: Abort in boost::asio::ip::tcp::acceptor constructor on Mac OS X (closed: fixed)">#3098</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54392" title="Fix custom memory allocation for timers. Ref #3107. ">r54392</a> | chris_kohlhoff | 2009-06-27 15:24:16 +1000 (Sat, 27 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix custom memory allocation for timers. Ref <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3107" title="#3107: Bugs: Error in allocation/dealocation of timers (closed: fixed)">#3107</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54393" title="Fix various g++ warnings. Ref #1341. ">r54393</a> | chris_kohlhoff | 2009-06-27 17:07:40 +1000 (Sat, 27 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix various g++ warnings. Ref <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1341" title="#1341: Patches: unused argument and another g++ warning (closed: fixed)">#1341</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54400" title="Use boost::throw_exception() rather than throw keyword to allow asio ...">r54400</a> | chris_kohlhoff | 2009-06-27 17:52:11 +1000 (Sat, 27 Jun 2009) | 4 lines </p> </blockquote> <p> </p> <blockquote> <p> Use boost::throw_exception() rather than throw keyword to allow asio to be used when exception support is disabled. Note that the SSL wrappers still require exception support. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2754" title="#2754: Patches: [PATCH] building asio without exception support (closed: fixed)">#2754</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54407" title="Make links to function overloads more obvious. ">r54407</a> | chris_kohlhoff | 2009-06-27 19:13:24 +1000 (Sat, 27 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Make links to function overloads more obvious. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54466" title="Add header file information to reference docs. Refs #3157. ">r54466</a> | chris_kohlhoff | 2009-06-28 23:07:43 +1000 (Sun, 28 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Add header file information to reference docs. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3157" title="#3157: Support Requests: ASIO Reference has no header file information (closed: fixed)">#3157</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54467" title="Treat 0-byte reads and writes as no-ops to comply with the documented ...">r54467</a> | chris_kohlhoff | 2009-06-28 23:20:17 +1000 (Sun, 28 Jun 2009) | 4 lines </p> </blockquote> <p> </p> <blockquote> <p> Treat 0-byte reads and writes as no-ops to comply with the documented type requirements for <a class="missing wiki">SyncReadStream</a>, <a class="missing wiki">AsyncReadStream</a>, <a class="missing wiki">SyncWriteStream</a> and <a class="missing wiki">AsyncWriteStream</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/54498" title="Add enum values to doc index. Refs #2620. ">r54498</a> | chris_kohlhoff | 2009-06-29 19:32:41 +1000 (Mon, 29 Jun 2009) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Add enum values to doc index. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2620" title="#2620: Bugs: Missing entries in documentation index (closed: fixed)">#2620</a>. </p> </blockquote> <p> ........ </p> Ticket