Open alecandido opened 2 weeks ago
Related to #38
We could use the compiler address sanitize option (-fsanitize=address
). Usually, this is quite useful and simple to catch memory leaks when executing tests.
Address sanitization is not the only one (I didn't know even that), and the other ones seem also pretty useful:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
e.g. -fsanitize=leak
(particularly relevant for this issue).
However, here is a brief comparison with Valgrind: https://stackoverflow.com/a/47261999/8653979
Since we're exposing a C API, and we'll have examples for its usage, we should not only test for the absence of errors while running, but even the possible memory leaks, using tools like Valgrind (possibly in the CI).