使用 Valgrind 检查是否有泄漏。我在网上找到了这两个命令,但有什么不同?除了这两个命令之外,还有其他更好/正确的 Valgrind 命令吗?
valgrind --leak-check=yes ./program
或者
valgrind --leak-check=full -v ./program
最佳答案
man valgrind
-v, --verbose
Be more verbose. Gives extra information on various aspects of your program, such as: the shared objects loaded, the suppressions used, the progress of the instrumentation and execution engines, and warnings about unusual behaviour. Repeating the option increases the verbosity level.
--leak-check= [default: summary]
When enabled, search for memory leaks when the client program finishes. If set to summary, it says how many leaks occurred. If set to full or yes, each individual leak will be shown in detail and/or counted as an error, as specified by the options --show-leak-kinds and --errors-for-leak-kinds.
关于c - C中的Valgrind检查是否有泄漏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52844227/