XInitThreads resources not freed
I tried to experiment with threads in X11, and came across a very simple issue : XInitThreads allocate some memory that I couldn't find a way to free. This programm :
#include <X11/Xlib.h>
int main(void)
{
XInitThreads();
Display *display = XOpenDisplay(NULL);
XCloseDisplay(display);
}
doesn't free all of it's memory according to valgrind :
==22054== HEAP SUMMARY:
==22054== in use at exit: 80 bytes in 2 blocks
==22054== total heap usage: 66 allocs, 64 frees, 60,600 bytes allocated
==22054==
==22054== 40 bytes in 1 blocks are still reachable in loss record 1 of 2
==22054== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22054== by 0x4E6812B: XInitThreads (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==22054== by 0x108896: main (main.c:24)
==22054==
==22054== 40 bytes in 1 blocks are still reachable in loss record 2 of 2
==22054== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22054== by 0x4E68144: XInitThreads (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==22054== by 0x108896: main (main.c:24)
==22054==
==22054== LEAK SUMMARY:
==22054== definitely lost: 0 bytes in 0 blocks
==22054== indirectly lost: 0 bytes in 0 blocks
==22054== possibly lost: 0 bytes in 0 blocks
==22054== still reachable: 80 bytes in 2 blocks
==22054== suppressed: 0 bytes in 0 blocks
I tried to have a display opening/closing in case that would be it, but it changes nothing... I couldn't find anything to resolve this in the documentation for XInitThreads, so I figured here would be the best place to put this.