Valgrind没有显示绝对丢失的内存的来源 [英] Valgrind doesn't show the sources of definitely lost memory

查看:180
本文介绍了Valgrind没有显示绝对丢失的内存的来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Valgrind检测到内存肯定丢失了,但没有显示源代码(只是问号):

Valgrind detects memory that is definitely lost but doesn't show me the source (just question marks):

==9859== 32 bytes in 1 blocks are definitely lost in loss record 61 of 274
==9859==    at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==9859==    by 0x100F8FB9: ???
==9859==    by 0x3A6F: ???
==9859==    by 0x1F: ???
==9859==    by 0x12C24F07: ???
==9859==    by 0x87: ???

为什么没有显示源(甚至没有显示 main()函数中的开始)?我该怎么办?我需要在哪里确定问题或泄漏源?

Why are the sources not shown (not even the start in the main() function)? What should I do? Where do I need to look to determine the problem or the sources of the leak?

推荐答案

最常见的问号来源而不是函数名称(至少在我的实践中)是缺少调试信息.如果您使用的是gcc,请尝试使用-g选项进行编译和链接.

The most often source of question marks instead of function names(at least in my practice) is the lack of the debugging info. If you're using gcc, try compiling and linking with -g option.

这篇关于Valgrind没有显示绝对丢失的内存的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆