Valgrind C++内存在空文件中泄漏

Myo*_*one 10 c++ macos xcode valgrind

我在valgrind中遇到"额外"内存泄漏问题.例如,我创建了一个名为temp.cpp的测试程序:

int main() { return 0; }
Run Code Online (Sandbox Code Playgroud)

在终端,我运行:

>> g++ -o temp.out temp.cpp
>> valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all ./temp.out
Run Code Online (Sandbox Code Playgroud)

这会导致几次内存泄漏.怎么会这样?

==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
Run Code Online (Sandbox Code Playgroud)

我试过运行其他.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
Run Code Online (Sandbox Code Playgroud)

Apple LLVM版本6.1.0(clang-602.0.53)(基于LLVM 3.6.0svn)目标:x86_64-apple-darwin15.0.0线程模型:posix

小智 2

valgrind 在 MacOSX 上似乎有问题。虽然这些问题尚未解决,但可能的临时解决方案是使用抑制文件。欲了解更多详情,请查看另一个答案