Memory leak C++

后端 未结 10 796
野趣味
野趣味 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 07:00

    If the program is exiting, you do not have to worry about memory which was allocated with malloc or new. The OS will take care of it - anything in your process' virtual address space exclusively will go away when the process dies. If you're using shared memory or named pipes it could still be a concern.

提交回复
热议问题