【发布时间】:2015-04-06 23:53:17
【问题描述】:
我已经阅读了无数关于此的问题,但没有一个答案有帮助。
由于代码太多,我无法发布我的代码,但我会提供我的 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)
这个输出对我没有任何帮助,如果有人可以提供帮助,我将不胜感激。
【问题讨论】: