Troubleshooting memory leak with stdweak_ptr How to detect and fix the bug