Note: This may sound dumb.
I have an application which uses raw pointers and there are lots of memory leaks in the application.
Now my question is how easy would it be to replace the existing raw pointers with the smart pointers.
And would just replacing them help is reducing memory leaks caused by not freeing dynamically allocated memory.
To explain a little further, This application is a legacy one and there are very straightforward memory leaks where memory will be allocated and wont be released in same function itself.
I have done an memory analysis using DevPartner and found many areas. Is Valgrind better than Devpartner.
Using smart pointers would certainly be a good start to cleaning up your application, but they’re not a cure-all. Lots of memory leaks could just be carelessness in an otherwise well designed program, but more likely you have significant design issues and the memory leaks are a symptom of that. When you switch to smart pointers, you still will need to make design choices like “Who owns this object,” “Is ownership of this object shared between multiple clients” and “What is the expected lifetime of this object” in order to choose the proper smart pointer implementation for the given scenario. But this will be a good way to start because the process of choosing the proper flavor of smart pointer for different situations will force you to think about these things and will probably improve your design.