title: C++ asynchronous call best practice
body: <p>I'm working with boost::asio. I wrote a class responsible for asynchronous reading from socket. 
  In my application io_service can be stopped and started many times during one application run.
  So I have to worry about memory leakage when service is stopped.
  I came to two solutions:</p>
  
  <ol>
  <li><p>A class asking for asynchronous request provides function with a buffer for using in asio reads, and it is responsible for its freeing. This is an obvious solution but I don't like it. Passing a parameter you don't need to a function looks realy strange.</p></li>
  <li><p>Smart pointer binded to a callback. Example here:
  <a href="http://pastebin.com/p8nQ5NFi" rel="nofollow">http://pastebin.com/p8nQ5NFi</a></p></li>
  </ol>
  
  <p>Now I'm using the second solution but however I'm feeling, I'm inventing a wheel. What's a common practice for buffer cleanage in asynchronous call? Are there any hidden problems in my aproach?</p>