GNOME Bugzilla – Bug 668894
xvimagesink memleak
Last modified: 2012-01-30 18:25:44 UTC
Please try this pipeline: gst-launch -e -v videotestsrc num-buffers=32 ! xvimagesink valgrind reports: ==9324== 124 bytes in 1 blocks are definitely lost in loss record 1,759 of 1,928 ==9324== at 0x4C28F9F: malloc (vg_replace_malloc.c:236) ==9324== by 0xA3B6564: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0) ==9324== by 0xA3B662A: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0) ==9324== by 0xA3B61CA: xcb_connect_to_display_with_auth_info (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0) ==9324== by 0x9C99A01: _XConnectXCB (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0) ==9324== by 0x9C89740: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0) ==9324== by 0x961F553: gst_xvimagesink_xcontext_get (xvimagesink.c:1800) ==9324== by 0x9625D67: gst_xvimagesink_change_state (xvimagesink.c:2292) ==9324== by 0x4E71E9B: gst_element_change_state (gstelement.c:2761) ==9324== by 0x4E727F1: gst_element_set_state_func (gstelement.c:2717) ==9324== by 0x4E5EEA9: gst_bin_change_state_func (gstbin.c:2209) ==9324== by 0x4E71E9B: gst_element_change_state (gstelement.c:2761) ==9324== by 0x4E727F1: gst_element_set_state_func (gstelement.c:2717) ==9324== by 0x403AF1: main (gst-launch.c:1104)
This does not look like a but in gstreamer as the function that closes the display also frees other stuff, which apparently do not leak since you only pasted that one above, so this suggests XCloseDisplay was called on the context. Now, I'm no X hacker, so it may be we're misusing the API somehow, but at first glance it seems a xcb issue. Building with libxcb debug info to pinpoint the leak might help by looking at what exactly is leaking there.
Here is the valgrind report with libxcb debug symbols: ==6137== 124 bytes in 1 blocks are definitely lost in loss record 1,759 of 1,925 ==6137== at 0x4C28F9F: malloc (vg_replace_malloc.c:236) ==6137== by 0xA3B6564: get_peer_sock_name (xcb_auth.c:259) ==6137== by 0xA3B662A: _xcb_get_auth_info (xcb_auth.c:302) ==6137== by 0xA3B61CA: xcb_connect_to_display_with_auth_info (xcb_util.c:424) ==6137== by 0x9C99A01: _XConnectXCB (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0) ==6137== by 0x9C89740: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0) ==6137== by 0x961F553: gst_xvimagesink_xcontext_get (xvimagesink.c:1800) ==6137== by 0x9625D67: gst_xvimagesink_change_state (xvimagesink.c:2292) ==6137== by 0x4E71E9B: gst_element_change_state (gstelement.c:2761) ==6137== by 0x4E727F1: gst_element_set_state_func (gstelement.c:2717) ==6137== by 0x4E5EEA9: gst_bin_change_state_func (gstbin.c:2209) ==6137== by 0x4E71E9B: gst_element_change_state (gstelement.c:2761) ==6137== by 0x4E727F1: gst_element_set_state_func (gstelement.c:2717) ==6137== by 0x403AF1: main (gst-launch.c:1104)
the problem seems in libxcb, reported there: https://bugs.freedesktop.org/show_bug.cgi?id=45390
Known bug in libxcb 1.7, fixed in the recently released libxcb 1.8: https://bugs.freedesktop.org/show_bug.cgi?id=28526
Thanks for the info Alan.