小编Mik*_*ike的帖子

调用 calloc - 内存泄漏 valgrind

以下代码是NCURSES菜单库中的一个示例。我不确定代码有什么问题,但 valgrind 报告了一些问题。有任何想法吗...

==4803== 1,049 (72 direct, 977 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 36
==4803==    at 0x4C24477: calloc (vg_replace_malloc.c:418)
==4803==    by 0x400E93: main (in /home/gerardoj/a.out)
==4803== 
==4803== LEAK SUMMARY:
==4803==    definitely lost: 72 bytes in 1 blocks
==4803==    indirectly lost: 977 bytes in 10 blocks
==4803==      possibly lost: 0 bytes in 0 blocks
==4803==    still reachable: 64,942 bytes in 262 blocks
Run Code Online (Sandbox Code Playgroud)

源代码:

#include <curses.h>
#include <menu.h>

#define ARRAY_SIZE(a) (sizeof(a) / …
Run Code Online (Sandbox Code Playgroud)

c valgrind ncurses calloc

5
推荐指数
1
解决办法
3753
查看次数

标签 统计

c ×1

calloc ×1

ncurses ×1

valgrind ×1