I'm trying to hunt down memory leaks in librdkafka. However, when I try to valgrind a minimal example application, Valgrind often aborts, complaining about some kind of "Invalid read of size 8". Alpine 3.5 + Valgrind 3.12: https://github.com/mcandre/docker-rdkafka-valgrind/tree/04ccabd15f0672a30427c7678aaf27c7032dcdd6 Debian Jessie + Valgrind 3.10: https://github.com/mcandre/docker-rdkafka-valgrind/tree/feacbfc562664d92ccd38d3f7c3165163f898f4c
To work around this issue, you should link the rdkafka application dynamically. Even if we fix the bug you reported, valgrind will not be able to recognize memory allocations in a statically linked application, so it will not be useful for discovering memory leaks.