9
valgrind --leak-check=full ./CH02_HelloTriangle 
==11404== Memcheck, a memory error detector
==11404== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==11404== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==11404== Command: ./CH02_HelloTriangle
==11404== 
==11404== Jump to the invalid address stated on the next line
==11404==    at 0x0: ???
==11404==    by 0x6F9271A: ??? (in /usr/lib/fglrx/dri/fglrx_dri.so)
==11404==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==11404== 
==11404== 
==11404== Process terminating with default action of signal 11 (SIGSEGV)
==11404==  Bad permissions for mapped region at address 0x0
==11404==    at 0x0: ???
==11404==    by 0x6F9271A: ??? (in /usr/lib/fglrx/dri/fglrx_dri.so)
==11404== 
==11404== HEAP SUMMARY:
==11404==     in use at exit: 144,423 bytes in 407 blocks
==11404==   total heap usage: 1,009 allocs, 602 frees, 189,993 bytes allocated
==11404== 
==11404== LEAK SUMMARY:
==11404==    definitely lost: 0 bytes in 0 blocks
==11404==    indirectly lost: 0 bytes in 0 blocks
==11404==      possibly lost: 0 bytes in 0 blocks
==11404==    still reachable: 144,423 bytes in 407 blocks
==11404==         suppressed: 0 bytes in 0 blocks
==11404== Reachable blocks (those to which a pointer was found) are not shown.
==11404== To see them, rerun with: --leak-check=full --show-reachable=yes
==11404== 
==11404== For counts of detected and suppressed errors, rerun with: -v
==11404== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)

究竟是什么问题?

如果我运行此应用程序,它只会以分段错误错误退出,它是使用 AMD GLES SDK for desktop 编译的 OpenGL ES 2.0 应用程序。

这是此应用程序的来源。

4

1 回答 1

9

中的代码/usr/lib/fglrx/dri/fglrx_dri.so正在跳过一个空函数指针。

当然,真正的问题是为什么,但由于这是专有的封闭源代码,您没有简单的方法来找出答案。如果您在该代码中调用任何将函数指针作为回调的函数,那么确保您没有将空指针传递给它们将是一个好的开始。

基本上,虽然这不是 valgrind 可能会帮助您找到的问题,但我很害怕,而且它肯定与内存泄漏无关。

于 2012-09-14T09:17:34.077 回答