The easiest way is to use Valgrind (on Linux and Mac) and a similar tool for Windows.
You can also take a backtrace (using the backtrace () function on Linux and Mac) or a similar function from dbghelp.dll on windows in the smart pointer constructor, and then save the return line somewhere to the selection and remove the backtrace to free. Then print all remaining return paths at the output.
mauve source share