sony / nmos-cpp

An NMOS (Networked Media Open Specifications) Registry and Node in C++ (IS-04, IS-05)
Apache License 2.0
139 stars 80 forks source link

Checking For Memory Leaks #194

Closed 79rpm closed 3 years ago

79rpm commented 3 years ago

Hello, would you please let me know if memory leaks are tracked on this library at all? Are you running the library through tools like Valgrind?

garethsb commented 3 years ago

I suggest retitling this "Checking For Memory Leaks"!

Valgrind is not currently run as part of the GitHub Action CI, but I test the apps by running both nmos-cpp-node and nmos-cpp-registry with e.g.

valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes ./nmos-cpp-node

Having just done that, I see:

==48544== LEAK SUMMARY:
==48544==    definitely lost: 0 bytes in 0 blocks
==48544==    indirectly lost: 0 bytes in 0 blocks
==48544==      possibly lost: 0 bytes in 0 blocks
==48544==    still reachable: 3,409 bytes in 34 blocks
==48544==         suppressed: 0 bytes in 0 blocks

The still reachable blocks are all related to D-Bus, and I believe are spurious. The D-Bus documentation suggests building D-Bus from source, configured with some special flags, and disabling D-Bus's message cache during your run. (See https://cgit.freedesktop.org/dbus/dbus/tree/README.valgrind.)

79rpm commented 3 years ago

Hi Gareth, thank you very much for responding quickly. This is the kind of information I was looking for, thank you for confirming your steps.