of cource, no memory leak.
check out the source code of method 'reset'.
there is a little trick help release the memory, which is similar with Effective STL: item 17: Use "swap trick" to trim excess capacity
 
good luck
 
 
------------------ Original ------------------
Date:  Thu, Mar 19, 2009 08:28 AM
To:  "boost-users"<boost-users@lists.boost.org>;
Subject:  [Boost-users] share_ptr reset() question
 
Hello,

Consider the following:

void createSharePtr( boost::shared_ptr<int> value)
{
    value.reset( new int(100));
}

main()
{
    boost::shared_ptr<int> y( new int(0));
    createSharePtr( y);
};

Question: Does the function createSharePtr() cause memory leak?

Thanks,
Ben

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users