<DIV>of cource, no memory leak.</DIV>
<DIV>check out the source code of method 'reset'.</DIV>
<DIV>there is a little trick help release the memory, which is similar with Effective STL: item 17: Use "swap trick" to trim excess capacity</DIV>
<DIV>&nbsp;</DIV>
<DIV>good luck</DIV>
<DIV><includetail>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; FONT-FAMILY: Arial Narrow">------------------&nbsp;Original&nbsp;------------------</DIV>
<DIV style="FONT-SIZE: 12px">
<DIV id=menu_sender><B>From: </B>&nbsp;"Ben"&lt;befung@gmail.com&gt;;</DIV>
<DIV><B>Date: </B>&nbsp;Thu, Mar 19, 2009 08:28 AM</DIV>
<DIV><B>To: </B>&nbsp;"boost-users"&lt;boost-users@lists.boost.org&gt;; </DIV>
<DIV></DIV>
<DIV><B>Subject: </B>&nbsp;[Boost-users] share_ptr reset() question</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV style="FONT-WEIGHT: normal">Hello,<BR><BR>Consider the following:<BR><BR>void createSharePtr( boost::shared_ptr&lt;int&gt; value)<BR>{<BR>&nbsp;&nbsp;&nbsp; value.reset( new int(100));<BR>}<BR><BR>main()<BR>{<BR>&nbsp;&nbsp;&nbsp; boost::shared_ptr&lt;int&gt; y( new int(0));<BR>&nbsp;&nbsp;&nbsp; createSharePtr( y);<BR>};<BR><BR>Question: Does the function createSharePtr() cause memory leak? <BR><BR>Thanks,<BR>Ben<BR><BR>_______________________________________________<BR>Boost-users mailing list<BR>Boost-users@lists.boost.org<BR>http://lists.boost.org/mailman/listinfo.cgi/boost-users</DIV></includetail></DIV>