Replies: 7 comments 2 replies
-
|
The check ensures that each individual test does not leak memory. So after each test memory usage should like before, otherwise the tests leaks memory. Which tests fails? On main branch everything looks good to me. Edit: maybe a global cache is not closed/cleaned properly for your new test (like dns cache etc.) |
Beta Was this translation helpful? Give feedback.
-
|
Yes, I know. Here: #1520 |
Beta Was this translation helpful? Give feedback.
-
|
Reproduce with mentioned branch from #1520. ~/src/re/build $ ./test/retest -d ../test/data -r test_dns_parallel -v |
Beta Was this translation helpful? Give feedback.
-
|
Not interesting here are the mem leaks that originate from
|
Beta Was this translation helpful? Give feedback.
-
|
There are leaked DNS queries (you can ignore the unrelated re_main objects): 0x55b607cf0fd0: nrefs=1 size=18 [74 65 73 74 31 2e 65 78 61 6d 70 6c 65 2e 6e 65 ] [test1.example.ne]
./build/test/retest(+0xc56d5) [0x55b5f85d26d5]
btrace at /home/runner/work/re/re/src/mem/mem.c:23 (discriminator 1)
./build/test/retest(mem_alloc+0xa8) [0x55b5f85d281e]
mem_alloc at /home/runner/work/re/re/src/mem/mem.c:169
./build/test/retest(dns_dname_decode+0x100) [0x55b5f85b0e3a]
dns_dname_decode at /home/runner/work/re/re/src/dns/dname.c:181 (discriminator 1)
./build/test/retest(dns_rr_decode+0x6c) [0x55b5f85b1f11]
dns_rr_decode at /home/runner/work/re/re/src/dns/rr.c:224
./build/test/retest(+0xa0f66) [0x55b5f85adf66]
reply_recv at /home/runner/work/re/re/src/dns/client.c:299
./build/test/retest(+0xa130b) [0x55b5f85ae30b]
udp_recv_handler at /home/runner/work/re/re/src/dns/client.c:376
./build/test/retest(+0xe8536) [0x55b5f85f5536]
udp_read at /home/runner/work/re/re/src/udp/udp.c:207
./build/test/retest(+0xe8597) [0x55b5f85f5597]
udp_read_handler at /home/runner/work/re/re/src/udp/udp.c:221
./build/test/retest(+0xc3128) [0x55b5f85d0128]
fd_poll at /home/runner/work/re/re/src/main/main.c:931
./build/test/retest(re_main+0x17a) [0x55b5f85d0433]
re_main at /home/runner/work/re/re/src/main/main.c:1065
./build/test/retest(re_main_timeout+0x7d) [0x55b5f858ead3]
re_main_timeout at /home/runner/work/re/re/test/test.c:1048
./build/test/retest(+0x3463c) [0x55b5f854163c]
test_dns_parallel_param at /home/runner/work/re/re/test/dns.c:701
./build/test/retest(test_dns_parallel+0x8f) [0x55b5f854184a]
test_dns_parallel at /home/runner/work/re/re/test/dns.c:740
./build/test/retest(+0x80756) [0x55b5f858d756]
test_unit at /home/runner/work/re/re/test/test.c:587
./build/test/retest(test_reg+0x5e) [0x55b5f858e05f]
test_reg at /home/runner/work/re/re/test/test.c:805
./build/test/retest(main+0x390) [0x55b5f855c294]
main at /home/runner/work/re/re/test/main.c:236 |
Beta Was this translation helpful? Give feedback.
-
|
Yes, after analyzing everything else I came to the same conclusion. But it takes some effort each time a memory leak happens during development of a unit test. I opened this issues to discuss if we could limit the output to the essentials. Can we? |
Beta Was this translation helpful? Give feedback.
-
|
I tried to add a if (mstat_after.blocks_cur > mstat_before.blocks_cur) {
libre_close();
mem_debug();
re_assert(false && "Test leaks memory blocks");
}It looks similar to how it is done in the Edit: commit f1d55b6 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently it is difficult to develop unit tests because there are some unrelated memory leaks reported with their backtrace.
If this happens:
memory leaks related to
libre_init()are reported.Is a
libre_close()missing here?Beta Was this translation helpful? Give feedback.
All reactions