
31 Jul
2008
31 Jul
'08
3:39 p.m.
On Wednesday 30 July 2008 16:03 pm, Alexander Gutenev wrote:
I want to use intrusive_ptr as a smart pointer to have reference counting without shared_ptr overhead.
I'm curious, could you be more specific about how your implementation has less overhead than shared_ptr? Do you mean it uses less memory? Compiles faster? Runs faster?
Less memory. The overhead of shared_ptr is allocation of another object which has reference count and deleter object. It is allocated in a separate block, hence memory overhead - that's the most noticeable when I have a lot of pointers to small objects. Also shared_ptr itself is double sized then. Also it is a bit more slow for allocation and deletion - but this is not noticeable in my case.