【发布时间】:2012-09-12 20:58:06
【问题描述】:
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 应用程序。
This the source 用于此应用程序。
【问题讨论】:
-
你试过在典型的调试器下运行它吗?这看起来不像是内存泄漏,而是某种空指针异常,我不确定 Valgrind 是否适合调试 NPE。
-
@Tim 我没有这个 OpenGL ES 库的调试版本,而且我不知道有没有其他工具可以在没有调试库的情况下使用。
-
我认为您不需要调试 OGLES 库,而只需确保调用它的应用程序不会将空值传递给 api 调用。您可以在您的特定语言使用的任何 IDE 中单步执行代码。
-
@Tim 代码很短而且一点也不复杂,我真的不知道这个code.google.com/p/opengles-book-samples/source/browse/trunk/… 代码有什么问题,而且所有其他包含都是标题...
标签: opengl-es-2.0 gpu valgrind ati amd-processor