Closed gabs1234 closed 11 months ago
sizeof(communicator)
gives 8. So there's actually some memory leaking going on. With --leak-check=full
, I find:
==45885== HEAP SUMMARY:
==45885== in use at exit: 278,165 bytes in 2,329 blocks
==45885== total heap usage: 6,583 allocs, 4,254 frees, 2,483,386 bytes allocated
==45885==
==45885== 14 bytes in 1 blocks are definitely lost in loss record 139 of 1,927
==45885== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==45885== by 0x4935738: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==45885== by 0x494A583: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==45885== by 0x4A8581C: g_inet_address_to_string (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7200.4)
==45885== by 0x10C70E: uca_phantom_communicate_discover (uca-phantom-communicate.c:456)
==45885== by 0x10C70E: uca_phantom_communicate_attempt_connect (uca-phantom-communicate.c:565)
==45885== by 0x10B982: main (test_network.c:37)
So a malloc isn't being free'd before I ctrl+c.
So actually I introduced the memroy leak by letting github copilot malloc something while forgetting to free it... Darn AI.
That being said, the main issue persists.
I might simply be overwhelming the IO capacity of the phantom camera (or the PC ? seems unlikely).
This would explain why the only solution to the problem is adding some waiting time between each call.
Issue was fixed in cad4a3c9719a115463e9091ebcc32df99ea30731: was caused by some trailing carriage return
Problem description
Behaviour is undefined when doing the following:
Indeed, after a certain and seemingly random amount of requests, the program feezes. However, by adding a blocking sleep command at the end of the loop, all requests are made and all answers are received.
Valgrind output
The memory leak is likely due to the communicator object not being freed after the
ctl+c
signal.