[Bug 790042] New: waylandsink: memory leak of shm allocator

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Nov 8 02:33:09 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=790042

            Bug ID: 790042
           Summary: waylandsink:  memory leak of shm allocator
    Classification: Platform
           Product: GStreamer
           Version: 1.12.2
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-bad
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: ssaito at igel.co.jp
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 363186
  --> https://bugzilla.gnome.org/attachment.cgi?id=363186&action=edit
Patche that can solve leaks

I tested the next pipelines with valgrind and the following leak was detected
in either case.
惻valgrind --leak-check=full --suppressions=./gst.supp gst-launch-1.0
videotestsrc ! video/x-raw, format=BGRA ! waylandsink

==3257== 216 (184 direct, 32 indirect) bytes in 1 blocks are definitely lost in
loss record 2,780 of 2,924
==3257==    at 0x49CDB10: g_type_create_instance (gtype.c:1844)
==3257==    by 0x49AE9D3: g_object_new_internal (gobject.c:1783)
==3257==    by 0x49B0647: g_object_newv (gobject.c:1930)
==3257==    by 0x49B0C8B: g_object_new (gobject.c:1623)
==3257==    by 0x7297E93: gst_wl_shm_allocator_register (wlshmallocator.c:114)
==3257==    by 0x7297A7B: plugin_init (gstwaylandsink.c:950)
==3257==    by 0x48F95AB: gst_plugin_register_func (gstplugin.c:524)
==3257==    by 0x48FB3FB: _priv_gst_plugin_load_file_for_registry
(gstplugin.c:827)
==3257==    by 0x48FC09B: gst_plugin_load_by_name (gstplugin.c:1266)
==3257==    by 0x48FCB2F: gst_plugin_feature_load (gstpluginfeature.c:112)
==3257==    by 0x48D1707: gst_element_factory_create (gstelementfactory.c:348)
==3257==    by 0x48D1A7F: gst_element_factory_make (gstelementfactory.c:445)
==3257==
==3257== LEAK SUMMARY:
==3257==    definitely lost: 184 bytes in 1 blocks
==3257==    indirectly lost: 32 bytes in 2 blocks
==3257==      possibly lost: 0 bytes in 0 blocks
==3257==    still reachable: 119,351 bytes in 2,018 blocks
==3257==                       of which reachable via heuristic:
==3257==                         length64           : 7,784 bytes in 188 blocks
==3257==                         newarray           : 1,648 bytes in 23 blocks

This is happening because the shm allocator is not released. The cause seems to
be because there is no unref after acquiring the allocator with
gst_wl_shm_allocator_get (). This function is called in gstwaylandsink.c and
wlwindow.c , and calls gst_allocator_find () internally, and the specification
states that unref is necessary after use.
https://developer.gnome.org/gstreamer/stable/GstAllocator.html#gst-allocator-find
Applying the attached patch can solve this leak.

I double checked in gstreamer 1.6.3 and there there is no unref for the shm
allocator there either, however executing valgrind in 1.6.3 will not detect
leak of the allocator. Looking at the log of refcount, we can confirm that
refcount itself remains. Did something change inside the allocator or
elsewhere?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list