
On 4/6/2011 11:23 AM, Thomas Klimpel wrote: [...]
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.
Of course there is something wrong with this ;) Imagine the nodes in the presentation are widgets. If you have a parent window which has a child window or dialog window, but the parent window is unreferenced. The Mark & Sweep algorithm will simply wipe away the parent window and leave the child dialog box on its own. Bests, -Phil