Memory leak C++

后端 未结 10 537
野趣味
野趣味 2021-02-02 06:02

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

10条回答
  •  后悔当初
    2021-02-02 06:39

    Use return 0; instead of exit(0); at the end of main. The use of exit circumvents the execution of the destructors.

提交回复
热议问题