|
Boost Users : |
Subject: Re: [Boost-users] share_ptr reset() question
From: ÕÅÑÇö (kimi67300387_at_[hidden])
Date: 2009-03-19 11:00:43
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 ------------------
From: "Ben"<befung_at_[hidden]>;
Date: Thu, Mar 19, 2009 08:28 AM
To: "boost-users"<boost-users_at_[hidden]>;
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net