Search⌘ K

Smart Pointers: Cyclic References

Explore how to identify and resolve cyclic references in std::shared_ptr instances in Modern C++. Learn to use std::weak_ptr to break reference cycles effectively, ensuring proper resource management and preventing memory leaks in embedded systems and other safety-critical applications.

We'll cover the following...

You get cyclic references of std::shared_ptr if they refer to each other.

The Issue

If you have a cyclic reference of std::shared_ptr, the reference counter will never ...