dicroce
dicroce

Reputation: 46800

Are there any static analysis tools that can help detect shared_ptr<> circular references?

Are there any static analysis tools that can help detect shared_ptr<> circular references?

Even if such a tool couldn't detect complicated cases, it would still be useful for eliminating the simple cases.

Upvotes: 8

Views: 477

Answers (1)

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99655

Don't know about existing of such tools, but here are nice thoughts about the problem:

The key to effective object life time management is to have an acyclic object ownership graph. Then you use shared pointers when going down, weak pointers when going sideways, and weak pointers (or sometimes plain pointers) when going up the graph.

Upvotes: 4

Related Questions