Boost logo

Boost :

Subject: Re: [boost] [Root Pointer] New Documentation
From: Artyom Beilis (artyom.beilis_at_[hidden])
Date: 2016-04-10 16:22:29


>> 1. From what I understand it is basically reference-counting pointer
>> with a "pool" that deletes pointers with dangling references. Am I
>> right?
>
>
> It really is a set of allocated blocks that are linked together using an
> intrusive list. When the last root_ptr referring to this set is destroyed
> then the whole set of allocated blocks is destroyed, regardless of cycles.
>
[...]
>> 2. What I thread safety assumptions on this library? i.e. does it use
>> atomic operations to handle reference counters?
>
>
> - It uses the same atomic operations as shared_ptr to handle the reference
> counter.
> - It also uses a global mutex when an assignment is made. This global mutex
> could be optimized but apparently there is no urgent need to do so because
> the speed of root_ptr is already faster than shared_ptr in multithreaded
> mode:
> http://philippeb8.github.io/root_ptr//images/performance.png
>

Ok this kind of suff is missing in the docs... I don't see the "algorithm"
section.

It isn't clear to me, The root_ptr holds linked list to blocks... that
if you delete
a single node_ptr so its ref-counter goes to 0 and object is destroyed, what
happens to its block - removed from linked list, is it used as cache for reuse?

How the list is protected for thread safety? By global mutex???

If so I see a great potential for a contention that makes it far worst
than shared_ptr.

Artyom


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