我在valgrind中有一个“额外的”内存泄漏的问题.例如,我创建了一个名为temp.cpp的测试程序:
int main() { return 0; }
在终端,我跑:
>> g++ -o temp.out temp.cpp >> valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all ./temp.out
这会导致几个内存泄漏.这怎么可能?
==4438== LEAK SUMMARY: ==4438== definitely lost: 4,120 bytes in 2 blocks ==4438== indirectly lost: 2,288 bytes in 6 blocks ==4438== possibly lost: 8,336 bytes in 99 blocks ==4438== still reachable: 6,440 bytes in 13 blocks ==4438== suppressed: 5,020 bytes in 73 blocks
我尝试运行其他.cpp文件,我得到完全相同的泄漏汇总.大约一个月前,当我试过,没有什么是错的.我可能会升级Xcode或某些东西,如果这可能是问题(?).这些是我的g设置:
配置为:
--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM版本6.1.0(clang-602.0.53)(基于LLVM 3.6.0svn)
目标:x86_64-apple-darwin15.0.0
线程模型:posix