a simple snippet like XFreeFontSet(d, XCreateFontSet(d, ...)) will generate lots of memory leaks, as evidenced by the following valgrind output: ==983== HEAP SUMMARY: ==983== in use at exit: 39,409 bytes in 341 blocks ==983== total heap usage: 4,795 allocs, 4,454 frees, 489,086 bytes allocated ==983== ==983== 1,688 (136 direct, 1,552 indirect) bytes in 1 blocks are definitely lost in loss record 40 of 46 ==983== at 0x4C2B042: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==983== by 0x56D5A93: add_codeset.clone.9 (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56D5FE0: load_generic (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56D7612: initialize (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56D7E75: _XlcCreateLC (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56F9A5F: _XlcUtf8Loader (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56DF815: _XOpenLC (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56B255A: XOpenOM (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x56A665A: XCreateFontSet (in /usr/lib64/libX11.so.6.3.0) ==983== by 0x4FCA80: conky::x11_output::create_gc() (x11.cc:746) ==983== by 0x4FC3B4: conky::x11_output::use_own_window() (x11.cc:602) ==983== by 0x4FAD42: conky::priv::own_window_setting::set(bool const&, bool) (x11.cc:92) ==983== ==983== LEAK SUMMARY: ==983== definitely lost: 136 bytes in 1 blocks ==983== indirectly lost: 1,552 bytes in 34 blocks ==983== possibly lost: 0 bytes in 0 blocks ==983== still reachable: 37,721 bytes in 306 blocks ==983== suppressed: 0 bytes in 0 blocks This patch makes the leak dissappear (Well, at least the "definitely lost part". The "still reachable" thingy remains). After some analysis, I've discovered that the XLCd structure is destroyed improperly. The "constructor" is in lcGeneric.c, but the structure is destroyed using code from lcPublic.c. I've found that changing the destructor call to _XlcDestroyLC executes the correct code path, and I'm pretty sure this is correct (the object was constructed using _XlcCreateLC, it make sense to destroy it using its conterpart). So far I haven't observed any strange behaviour on my system caused by this change (although, I'm not sure, how many programs actually use this function). Signed-off-by: Pavel Labath <pavelo@centrum.sk> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> |
||
|---|---|---|
| include | ||
| m4 | ||
| man | ||
| modules | ||
| nls | ||
| specs | ||
| src | ||
| .gitignore | ||
| AUTHORS | ||
| autogen.sh | ||
| configure.ac | ||
| COPYING | ||
| cpprules.in | ||
| docbook.am | ||
| Makefile.am | ||
| NEWS | ||
| README.md | ||
| x11-xcb.pc.in | ||
| x11.pc.in | ||
libX11 - Core X11 protocol client library
Documentation for this library can be found in the included man pages, and in the Xlib spec from the specs subdirectory, also available at:
https://www.x.org/releases/current/doc/libX11/libX11/libX11.html https://www.x.org/releases/current/doc/libX11/libX11/libX11.pdf
and the O'Reilly Xlib books, which they have made freely available online, though only for older versions of X11:
-
X Series Volume 2: Xlib Reference Manual (1989, covers X11R3) https://www.archive.org/details/xlibretmanver1102nyemiss
-
X Series Volume 2: Xlib Reference Manual, 2nd Edition (1990, covers X11R4) https://www.archive.org/details/xlibrefmanv115ed02nyemiss
All questions regarding this software should be directed at the Xorg mailing list:
https://lists.x.org/mailman/listinfo/xorg
The master development code repository can be found at:
https://gitlab.freedesktop.org/xorg/lib/libX11
Please submit bug reports and requests to merge patches there.
For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches