gpt4 book ai didi

c++ - 未初始化的值 - Valgrind

转载 作者:太空宇宙 更新时间:2023-11-04 04:38:23 24 4
gpt4 key购买 nike

我在 Yosemite 上的 Valgrind 有一个奇怪的问题。这是我的简单程序:

#include <stdio.h>
int main() {
printf("Hello world %d\n", 123);
return 0;
}

编译它然后使用 Valgrind 运行它我得到以下信息:

==48900== Conditional jump or move depends on uninitialised value(s)
==48900== at 0x1003FBC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
==48900== by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib)
==48900== by 0x100000F51: main (test.c:3)
==48900==
Hello world 123
==48900==
==48900== HEAP SUMMARY:
==48900== in use at exit: 39,212 bytes in 426 blocks
==48900== total heap usage: 506 allocs, 80 frees, 45,340 bytes allocated
==48900==
==48900== LEAK SUMMARY:
==48900== definitely lost: 16 bytes in 1 blocks
==48900== indirectly lost: 0 bytes in 0 blocks
==48900== possibly lost: 13,058 bytes in 117 blocks
==48900== still reachable: 26,138 bytes in 308 blocks
==48900== suppressed: 0 bytes in 0 blocks
==48900== Rerun with --leak-check=full to see details of leaked memory
==48900==
==48900== For counts of detected and suppressed errors, rerun with: -v
==48900== Use --track-origins=yes to see where uninitialised values come from
==48900== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

有什么建议吗?

最佳答案

这很有用:Yosemite and Valgrind虽然在过去的 OS X 发布周期中,Valgrind 可能需要一段时间才能获得合理的功能支持,但由于在预发布 Yosemite 上进行了大量工作,Valgrind 主干中已经提供了基本的 OS X 10.10 支持 – Dave Qorashi

关于c++ - 未初始化的值 - Valgrind,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28929598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com