Is there any tips/tricks for finding cyclic references of shared_ptr’s?
This is an exmaple of what I’m trying to find – unfortunately I can’t seem to find the loop in my code.
struct A
{
boost::shared_ptr<C> anC;
};
struct B
{
boost::shared_ptr<A> anA;
};
struct C
{
boost::shared_ptr<B> anB;
};
I used a combination of the above posts. I used a memory profiler, came up with some suspected cycles and broke those by using weak_ptr’s.
I’ve used the built in CRT memory leak detection before, but unfortunately in my case there are several static singletons that dont get deallocated until module unload which I believe is after the CRT detectors lifecycle. Basically it gives alot of spew that are false positives.