c - C中的Valgrind检查是否有泄漏

标签 c memory-leaks valgrind

使用 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/

相关文章:

c - wait() 函数是否在处理 SIGCHLD 之前返回?

C宏可以包含临时变量吗?

c - 分配 ram 显示任务管理器中 ram 使用量的两倍

python - 在清除树时使用 ElementTree.iterparse() 时内存使用量是否应该增加?

c++ - libxml 2 的 xml 复制 NodeList 中的内存泄漏

C、Valgrind 自由,因为没有任何 malloc 的大量分配

c - openmp是否分配内存并释放所有内存

c++ - 我应该将 printf 与 std::cin 混合使用吗?

c - 内存泄漏同步读取中断通过libUSB传输数据

c - C 中的堆栈 : why do i have memory leaks?