Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-11-11 14:40:12


Rene Rivera wrote:
> A "faster" way to infer cycles for pointers could be done with a bit
> more information on the shared_ptr. If you keep a set of object memory
> spans (heap address, and class sizeof) for all shared instances you
> can find all shared_ptrs that fall within those shared instances.

See sp_collector.cpp.

> With that you can build the reference graph to detect the cycles.

Except that you can't. :-)

struct X
{
    std::vector<Y> v_;
};

If Y has shared_ptr instances that refer back to X, this is untraceable,
because the tracer doesn't know that it should follow the pointer inside the
std::vector.


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