Boost logo

Boost :

Subject: Re: [boost] [shifted_ptr] Review Request
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2011-04-06 14:23:36

Phil Bouchard wrote:
> On 4/5/2011 7:39 AM, Thomas Klimpel wrote:
> [...]
> > But I would suggest a much easier step first. Your presentation
> > already exists, and it has many nice pictures and illustrates many
> > points. Yet I have the impression that it still fails to convey the
> > information that also some of the reviewers missed in 2003. Why don't
> > we try to "review" and improve this presentation first? To be honest, I
> > would really like to know what "shifted_ptr" is (or wants to be). As
> > there is already a 28 page presentation and many examples, this should
> > hopefully be a goal that can be achieved.
> I just added descriptions on each page of the presentation explaining
> what is being demonstrated.

The interesting information, what "shifted_ptr" is (or wants to be) is still missing.

At least I learned now that there is a difference between the library called "Shifted Pointer" and the class template "shifted_ptr". It's probably easier to separately describe the library (like "What is Shifted Pointer? The Shifted Pointer library provides a smart pointer class template and related helper functionality which allows deterministic memory management of constant complexity.") and the involved class templates (like "The shifted_ptr<T> smart pointer class template offers shared ownership of shifted<T> objects. It has normal pointer semantics, except when instantiated with an array (shifted_ptr<A[n]>), in which case it provides normal array semantics. It's actual behavior depends on whether it was created on the stack or on the heap, but it is possible to override...").

Writing anything even slightly incorrect or confusing here is still better than writing nothing at all. Otherwise the context is missing, and this can make it very challenging to follow your ideas.

> To answer your question shifted_ptr<> is an attempt to offer a better
> alternative than both shared_ptr<>, intrusive_ptr<> and all other
> garbage collection mechanisms. Please remember that:

I guess "shifted_ptr<>" is a class template, not an "attempt". The "Shifted Pointer library" may be an attempt to offer a garbage collection mechanism with unique advantages. If you immediately start comparing it with other libraries before even properly describing itself, you end up talking more about the other libraries than about the "Shifted Pointer library". Of course a "differences to ... " section later on in the documentation (or in an appendix) will normally be a good idea (like Boost.Xpressive contains a comparison to Boost.Regex).

> Furthermore you'll also notice a problem with the Mark & Sweep
> algorithm
> on slides 7 & 8, where a parent node still referencing a child node is
> being deleted. Slides 26 & 27 shows how this is not a problem with
> shifted_ptr<>.

There is nothing wrong with deleting an unreferenced node that still references other nodes itself. Perhaps you fear that there might still be implicit references to the object, which are not tracked. So you probably have taken a "region based memory management" point of view here. (You "feel" that the region hasn't yet been left yet, because the child is still around, so you fear that deleting the parent might be a bad idea.) Still it isn't a problem in the context of Mark & Sweep.


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