I had a bunch of memory leaks detected with CRTDBG but found them difficult to trace so installed Visual Leak Detection. This showed a consistent number of leaks which I traced to abstract classes not having virtual destructors. I fixed this and VLD now shows no memory leaks in my application, however CRTDBG still does and it's showing consistently around 100 or so leaks.
Can either of these tools be trusted with C++11? I'm heavily using unique pointers and barely making any new objects without them so can't understand where the leaks are coming from.
If you have some global objects or something on the stack in main()
, they won't be destroyed before the main()
exits.
If these objects do dynamic memory allocation and you call _CrtDumpMemoryLeaks()
at the very end of the main()
, you will still see that memory as "leaked."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With