Get the latest tech news
Tracking (C++) Shared Pointer Leaks
There are many good practices one can employ. I won’t delve into good practices here. I’ll go for the heavy guns
If I log all currently allocated blocks (or a select suspicious few), with my domain knowledge I can find or clear leak suspects based on the provided metadata. Every time a referer is added (via copying or creation), or changed (via moving or swapping), the control block gets notified with special method calls. Let’s say that we will use standard smart pointers most of the time to avoid worying about third party software and only resort to xmem occasionally, when we suspect leaks or when we run tests.
Or read this on Hacker News