我已经阅读了无数关于此的问题,但没有一个答案有帮助。
我无法发布我的代码,因为有太多,但我会提供我的makefile行和valgrind信息。
我正在使用gcc -std=c99 -Wall src/main.c src/filein.c src/make_game.c -g -O0 -Iinclude -o bin/rogue -lncurses
进行编译。
我用这个运行valgrind:valgrind --leak-check=full /home/pi/rogue/rogue/bin/rogue assets/room.txt
我的输出:
==2939== Memcheck, a memory error detector
==2939== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==2939== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==2939== Command: /home/pi/rogue/rogue/bin/rogue assets/room.txt
==2939==
==2939==
==2939== HEAP SUMMARY:
==2939== in use at exit: 117,855 bytes in 197 blocks
==2939== total heap usage: 306 allocs, 109 frees, 121,129 bytes allocated
==2939==
==2939== 900 bytes in 6 blocks are definitely lost in loss record 1 of 4
==2939== at 0x4835978: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2939==
==2939== LEAK SUMMARY:
==2939== definitely lost: 900 bytes in 6 blocks
==2939== indirectly lost: 0 bytes in 0 blocks
==2939== possibly lost: 0 bytes in 0 blocks
==2939== still reachable: 116,955 bytes in 191 blocks
==2939== suppressed: 0 bytes in 0 blocks
==2939== Reachable blocks (those to which a pointer was found) are not shown.
==2939== To see them, rerun with: --leak-check=full --show-reachable=yes
==2939==
==2939== For counts of detected and suppressed errors, rerun with: -v
==2939== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19 from 6)
这个输出对我没有任何帮助,如果有人可以提供帮助我真的很感激。
答案 0 :(得分:0)
您的输出不是显示行号的问题,而是整个回溯太短,因为它只显示malloc()
功能但不显示来电者。
您可以尝试使用较新的Valgrind版本。您的版本(3.7.0)已有几年历史,同时对ARM系统的回溯也有所改进。