Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-03-10 18:18:28

I see that shared_ptr is quite costly in multithreaded environments
cause it would need DCAS, and thus uses a spinlock in cases where it is
not available.
intrusive_ptr, which is only one word, does not need that.

Shouldn't intrusive_ptr be put forward more, then?

Or better, why not make a shared_ptr-like shared_obj, a container,
responsible for allocating the object, thus able to allocate a struct {
T value; int refcount; } instead of T's, and advocate its usage?
Such an interface could also trivially use a good garbage collection
algorithm instead of refcounting.

It seems to me that shared_ptr was made inefficient by design, which is
not a really good thing since it is getting more and more popular.

Could someone confirm or infirm this?

Boost list run by bdawes at, gregod at, cpdaniel at, john at