After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757453 - avvidenc: Fix frame memory leak
avvidenc: Fix frame memory leak
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
git master
Other Linux
: Normal normal
: 1.6.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-02 01:00 UTC by Vineeth
Modified: 2015-11-03 07:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix frame memory leak (892 bytes, patch)
2015-11-02 01:01 UTC, Vineeth
none Details | Review
fix frame memory leak (1.17 KB, patch)
2015-11-02 01:10 UTC, Vineeth
committed Details | Review

Description Vineeth 2015-11-02 01:00:31 UTC
When using sample pipeline
gst-launch-1.0 videotestsrc num-buffers=20 ! video/x-raw,framerate=25/1 ! avenc_mpeg2video ! mxfmux name=mux ! fakesink
found the below memory leak.


==6690== 127,399 (156 direct, 127,243 indirect) bytes in 1 blocks are definitely lost in loss record 3,033 of 3,034
==6690==    at 0x402C17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==6690==    by 0x421BBE2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==6690==    by 0x4232281: g_slice_alloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==6690==    by 0x423279C: g_slice_alloc0 (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==6690==    by 0x4CB9E76: gst_video_encoder_chain (gstvideoencoder.c:1338)
==6690==    by 0x40A28C7: gst_pad_push_data (gstpad.c:4104)
==6690==    by 0x40AB446: gst_pad_push (gstpad.c:4475)
==6690==    by 0x656E255: gst_base_transform_chain (gstbasetransform.c:2369)
==6690==    by 0x40A28C7: gst_pad_push_data (gstpad.c:4104)
==6690==    by 0x40AB446: gst_pad_push (gstpad.c:4475)
==6690==    by 0x6566652: gst_base_src_loop (gstbasesrc.c:2845)
==6690==    by 0x40D9888: gst_task_func (gsttask.c:331)



This is happening because, while handling frame, 
if encoder needs more data then it just returns GST_FLOW_OK without unref'ing the frame.
Comment 1 Vineeth 2015-11-02 01:01:48 UTC
Created attachment 314602 [details] [review]
fix frame memory leak
Comment 2 Vineeth 2015-11-02 01:10:13 UTC
Created attachment 314603 [details] [review]
fix frame memory leak

should be freed when input buffer failed to map as well
Comment 3 Sebastian Dröge (slomo) 2015-11-02 07:26:21 UTC
commit 2d94a1cbccf517732b3440ae09672959a84a0fe0
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Mon Nov 2 10:00:55 2015 +0900

    avvidenc: Fix frame memory leak
    
    The frame being passed to handle_frame should be unref'ed in all cases
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757453