I just wrote a code in C++ which does some string manipulation, but when I ran valgrind over, it shows some possible memory leaks. Debugging the code to granular level I wrote a
Use return 0; instead of exit(0); at the end of main. The use of exit circumvents the execution of the destructors.
return 0;
exit(0);
main
exit