Boost logo

Boost :

Subject: Re: [boost] concurrent garbage collector
From: Bjorn Reese (breese_at_[hidden])
Date: 2013-06-22 04:16:01


On 06/17/2013 10:41 PM, Taylor Holliday wrote:

> https://gist.github.com/wtholliday/5793270

I like the idea.

Some minor comments:

In the Collect() function the sequence is a static local variable. You
may consider making it a normal member variable (you have already
declared the "collector" variable as static.)

Apropos, you may consider using boost::call_once instead of using a
Meyers singleton, because the latter is not thread-safe.

In the mark phase you use an std::vector as a stack. It may be better to
use std::stack.

In the sweep phase you collect a new set and then assign it to the
old. You should probably use one of these instead:

   _nodes.swap(newNodes);

or if you are going for a C++11 only solution:

   _nodes = std::move(newNodes);


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