Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2007-10-07 00:34:10


On 10/6/07, Vladimir Batov <batov_at_[hidden]> wrote:
>
> Mathias,
>
> > Here is a simple deep-copying smart pointer.
> ...
> > That is nothing compared to the massive overhead of using shared_ptr.
>
> Well, I feel that "the massive overhead" is debatable. If you refer to
> implementation complexity, it's there for a reason and is not an issue as
> it's already there. If you refer to perfomance, then it's not a clear cut
> as
> it very much depends on an application and the usage pattern.

When it comes to performance, I think the key thing to understand about
shared_ptr is that copying them or having copies go out of scope are the
expensive operations. If you're just holding shared_ptrs to manage object
lifetime you're fine. But if you start passing them around all over the
place and making lots of short-lived copies, this is where you might run
into trouble.

-- 
Caleb Epstein

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk