使用valgrind 检测qt程序代码泄漏时,程序直接segment fault

写的qt程序为hello,然后运行命令为:valgrind ./hello,然后就报了如下错误:

==32140== 
==32140== Process terminating with default action of signal 11 (SIGSEGV)
==32140==  General Protection Fault
==32140==    at 0x222D16E6: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x222DEBD5: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x222DEFFF: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x21BD5C62: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x22093C22: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x21F54D13: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x21F500B6: ??? (in /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so)
==32140==    by 0x96FC232: ??? (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==32140==    by 0x96D3D03: ??? (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==32140==    by 0x96CF811: glXGetFBConfigs (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==32140==    by 0x96D0C01: glXChooseFBConfig (in /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0)
==32140==    by 0x178A9E16: ??? (in /home/zqh/Qt5.9.7/5.9.7/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so)
==32140== 
==32140== HEAP SUMMARY:
==32140==     in use at exit: 2,079,049 bytes in 19,963 blocks
==32140==   total heap usage: 97,272 allocs, 77,309 frees, 8,220,928 bytes allocated
==32140== 
==32140== LEAK SUMMARY:
==32140==    definitely lost: 229 bytes in 4 blocks
==32140==    indirectly lost: 2,549 bytes in 63 blocks
==32140==      possibly lost: 27,040 bytes in 402 blocks
==32140==    still reachable: 1,967,127 bytes in 18,823 blocks
==32140==                       of which reachable via heuristic:
==32140==                         length64           : 4,904 bytes in 80 blocks
==32140==                         newarray           : 2,096 bytes in 51 blocks
==32140==         suppressed: 0 bytes in 0 blocks
==32140== Rerun with --leak-check=full to see details of leaked memory
==32140== 
==32140== For counts of detected and suppressed errors, rerun with: -v
==32140== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Killed

 

解决办法是: 在命令行里添加此行命令:export LIBGL_ALWAYS_SOFTWARE=1

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值