gpt4 book ai didi

c - 尝试从 valgrind 读取泄漏摘要 - 程序在我的电脑上导致段错误,而不是在另一台电脑上

转载 作者:行者123 更新时间:2023-11-30 14:52:19 25 4
gpt4 key购买 nike

我有一个 C 代码 OpenGL 程序,可以在我的 ubuntu 机器上编译并运行良好。但是当我在另一个Linux上编译并运行它时,它会导致段错误。我使用 valgrind 来查看问题可能出在哪里,这是输出的一小部分:

==21294== LEAK SUMMARY:
==21294== definitely lost: 72 bytes in 1 blocks
==21294== indirectly lost: 0 bytes in 0 blocks
==21294== possibly lost: 0 bytes in 0 blocks
==21294== still reachable: 191,932 bytes in 1,397 blocks
==21294== suppressed: 0 bytes in 0 blocks
==21294==
==21294== ERROR SUMMARY: 8 errors from 3 contexts (suppressed: 0 from 0)
==21294==
==21294== 1 errors in context 1 of 3:
==21294== Syscall param ioctl(generic) points to uninitialised byte(s)
==21294== at 0x5936F07: ioctl (syscall-template.S:84)
==21294== by 0x7C0E0E7: drmIoctl (in /usr/lib/x86_64-linux-gnu/libdrm.so.2.4.0)
==21294== by 0x7C10DDE: drmCommandWriteRead (in /usr/lib/x86_64-linux-gnu/libdrm.so.2.4.0)
==21294== by 0xABF2DA0: nouveau_object_mthd (in /usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2.0.0)
==21294== by 0xABF3535: nouveau_device_new (in /usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2.0.0)
==21294== by 0xA0B9690: nouveau_drm_screen_create (in /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so)
==21294== by 0x9C7FD15: ??? (in /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so)
==21294== by 0x9F6C59B: ??? (in /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so)
==21294== by 0x9F67BD2: ??? (in /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so)
==21294== by 0x4E80AA2: ??? (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==21294== by 0x4E589C3: ??? (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==21294== by 0x4E53F00: glXQueryVersion (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)

valgrind 的完整输出文件有 15614 行长。我仍在学习它,但我可以使用帮助来阅读我正在查看的内容以及如何更正我的代码。另外,这是我在该网站上的第一篇文章,因此任何有关此问题的信息和一般发布的信息将不胜感激。

最佳答案

段错误与内存泄漏无关。要修复段错误,您应该阅读并修复 Valgrind 报告的错误,而不是内存泄漏。根据输出,Valgrind 发现了 8 个错误:

==21294== ERROR SUMMARY: 8 errors from 3 contexts (suppressed: 0 from 0)

在此处查看 Valgrind 错误和内存泄漏之间的区别:
Error summary in Valgrind output?

关于c - 尝试从 valgrind 读取泄漏摘要 - 程序在我的电脑上导致段错误,而不是在另一台电脑上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47666335/

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