You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ valgrind --tool=memcheck --leak-check=full ./test_hello
==5506== Memcheck, a memory error detector
==5506== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5506== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==5506== Command: ./test_hello
==5506==
[2024-05-06 09:31:06.768 hello, zlog
==5506==
==5506== HEAP SUMMARY:
==5506== in use at exit: 121,184 bytes in 16 blocks
==5506== total heap usage: 91 allocs, 75 frees, 896,548 bytes allocated
==5506==
==5506== 1,144 bytes in 1 blocks are definitely lost in loss record 3 of 5
==5506== at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==5506== by 0x484E01C: zlog_rotater_new (rotater.c:99)
==5506== by 0x484C2C9: zlog_conf_new_from_string (conf.c:267)
==5506== by 0x485445F: zlog_init_inner_from_string (zlog.c:98)
==5506== by 0x485445F: zlog_init_from_string (zlog.c:231)
==5506== by 0x10909C: main (test_hello.c:32)
==5506==
==5506== 120,040 (8,208 direct, 111,832 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
==5506== at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==5506== by 0x484C951: zlog_format_new (format.c:74)
==5506== by 0x484C2B1: zlog_conf_new_from_string (conf.c:260)
==5506== by 0x485445F: zlog_init_inner_from_string (zlog.c:98)
==5506== by 0x485445F: zlog_init_from_string (zlog.c:231)
==5506== by 0x10909C: main (test_hello.c:32)
==5506==
==5506== LEAK SUMMARY:
==5506== definitely lost: 9,352 bytes in 2 blocks
==5506== indirectly lost: 111,832 bytes in 14 blocks
==5506== possibly lost: 0 bytes in 0 blocks
==5506== still reachable: 0 bytes in 0 blocks
==5506== suppressed: 0 bytes in 0 blocks
==5506==
==5506== For counts of detected and suppressed errors, rerun with: -v
==5506== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
修改
test/test_hello.c
内容为如下:编译运行,显示内存泄露:
测试环境:
The text was updated successfully, but these errors were encountered: