Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 803
dicroce Avatar asked Sep 29 '10 19:09

dicroce


1 Answers

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.

like image 124
Kirill V. Lyadvinsky Avatar answered Sep 28 '22 01:09

Kirill V. Lyadvinsky