程式編譯時加上 -g 確保程式有跑過懷疑內存洩漏的地方,然後能正常結束 valgrind --tool=memcheck --leak-check=full your_program_bin arg1 arg2