GNOME Bugzilla – Bug 585911
matroskademux seems to leak large amounts of memory when seeking (skipping)
Last modified: 2009-06-23 17:46:06 UTC
Steps to reproduce: we're working on an embedded mips system (dreambox) with very limited ram when skipping (seek operation) during the playback in mkv media files, large amounts of ram are leaked until os freezes. minimal test case to be attached Stack trace: Other information:
Created attachment 136664 [details] test case run with mkv file uri as parameter
with avi or mpeg containers, no memory leaking occurs
There's no leak here with latest GIT when running this in valgrind and stopping the pipeline after the 100th seek. Can you confirm that all memory is freed when the pipeline is destroyed?
root@dm8000:~# /testProgs/leakseek file:///hdd/movie/mkv/Macross_F_-_21-test.mkv leakseek.c is linked against GStreamer 0.10.23 (CVS) ERROR: from element /GstPlayBin2:playbin20/GstPlaySink:playsink0: No volume control found Additional debug info: gstplaysink.c(1491): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0: Volume/mute is not available [do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek][do_seek]^C while this is running, in a second session: (sorry, our busybox's minimal version of free doesn't support the periodcal update) root@dm8000:~# free total used free shared buffers Mem: 125120 49048 76072 0 0 Swap: 0 0 0 Total: 125120 49048 76072 root@dm8000:~# free total used free shared buffers Mem: 125120 49048 76072 0 0 Swap: 0 0 0 Total: 125120 49048 76072 root@dm8000:~# free total used free shared buffers Mem: 125120 84676 40444 0 0 Swap: 0 0 0 Total: 125120 84676 40444 root@dm8000:~# free total used free shared buffers Mem: 125120 90132 34988 0 0 Swap: 0 0 0 Total: 125120 90132 34988 root@dm8000:~# free total used free shared buffers Mem: 125120 91992 33128 0 0 Swap: 0 0 0 Total: 125120 91992 33128 root@dm8000:~# free total used free shared buffers Mem: 125120 93604 31516 0 0 Swap: 0 0 0 Total: 125120 93604 31516 root@dm8000:~# free total used free shared buffers Mem: 125120 97448 27672 0 0 Swap: 0 0 0 Total: 125120 97448 27672 root@dm8000:~# free total used free shared buffers Mem: 125120 103152 21968 0 0 Swap: 0 0 0 Total: 125120 103152 21968 root@dm8000:~# free total used free shared buffers Mem: 125120 107368 17752 0 0 Swap: 0 0 0 Total: 125120 107368 17752 root@dm8000:~# free total used free shared buffers Mem: 125120 113196 11924 0 0 Swap: 0 0 0 Total: 125120 113196 11924 root@dm8000:~# free total used free shared buffers Mem: 125120 121504 3616 0 0 Swap: 0 0 0 Total: 125120 121504 3616 root@dm8000:~# free total used free shared buffers Mem: 125120 122992 2128 0 0 Swap: 0 0 0 Total: 125120 122992 2128 total used free shared buffers Mem: 125120 34564 90556 0 0 Swap: 0 0 0 Total: 125120 34564 90556 root@dm8000:~# free total used free shared buffers Mem: 125120 34548 90572 0 0 Swap: 0 0 0 Total: 125120 34548 90572
oops. sorry didn't mean to reopen.
So the memory is freed again while the program is running? In that case there's no leak I'd say... otherwise, does valgrind exist for your platform?
it's not freed until the application exits :( and there's no valgrind for mips :/
Have you tried reproducing this on a desktop with the exact versions of things you are using on the mips platform? Does it happen there as well? If there's perl on the platform, you could try http://www.schleef.org/~ds/mem_usage (if not, port it to C) - it's not valgrind, but certainly more useful than 'free'.
Also, as I just said on IRC: - does it happen with any .mkv file regardless of the codecs/formats inside it? - what do you use for decoders? - what is the exact matroskademux revision you are using? You say release=0.10.14 - but that is not the latest release, so have you tried 0.10.15?
actually i work with no release but git of core, base and good now it is NOT reproduceable on my amd64 gentoo pc it is not dependent of decoders (also happens when modifying the testcase app so that audio-sink and video-sink are set to be two fakesinks) i have to do more reseach about on which files it actually happens. here's the information about my test subject: Complete name : /dream/movie/mkv/Macross_F_-_21-test.mkv Format : Matroska File size : 15.3 MiB Duration : 1mn 18s Overal bit rate : 1640 Kbps Movie name : Macross Frontier - 21 - Diamond Crevasse Encoded date : UTC 2009-05-01 13:26:27 Writing application : mkvmerge v2.2.0 ('Turn It On Again') built on Mar 4 2008 12:58:26 Writing library : libebml v0.7.7 + libmatroska v0.8.1 Cover : Yes / Yes / Yes / Yes Video Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : Yes Format settings, ReFrames : 8 frames Codec ID : V_MPEG4/ISO/AVC Duration : 1mn 18s Nominal bit rate : 1813 Kbps Width : 1280 pixels Height : 720 pixels Display aspect ratio : 16/9 Frame rate : 23.976 fps Colorimetry : 4:2:0 Scan type : Progressive Bits/(Pixel*Frame) : 0.082 Title : Video (H.264) Writing library : x264 core 67 r1139 1024283 Encoding settings : cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=8 / psy_rd=0.6:0.0 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=1 / nr=0 / decimate=1 / mbaff=0 / bframes=4 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40 / rc=2pass / bitrate=1813 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=0 Language : Japanese Audio Format : AAC Format/Info : Advanced Audio Codec Format version : Version 4 Format profile : LC Format settings, SBR : No Codec ID : A_AAC Duration : 1mn 18s Channel(s) : 2 channels Channel positions : L R Sampling rate : 48.0 KHz Resolution : 16 bits Title : Japanese Audio (2ch AAC) Language : Japanese Text Format : ASS Codec ID : S_TEXT/ASS Codec ID/Info : Advanced Sub Station Alpha Title : English Subtitles (ASS) Language : English Chapters Language : English 1 : 00:00:00.000 Intro
it does NOT leak with this file: General Complete name : /dream/movie/mkv/testzdf.mkv Format : Matroska File size : 41.9 MiB Duration : 1mn 1s Overal bit rate : 5748 Kbps Encoded date : UTC 2008-09-23 10:32:52 Writing application : mkvmerge v2.2.0 ('Turn It On Again') built on Jul 7 2008 19:13:42 Writing library : libebml v0.7.8 + libmatroska v0.8.1 Video Format : MPEG Video Codec ID : V_MPEG2 Codec ID/Info : MPEG 1 or 2 Video Duration : 1mn 1s Bit rate : 4676 Kbps Width : 720 pixels Height : 576 pixels Display aspect ratio : 16/9 Frame rate : 25.000 fps Standard : PAL Audio #1 Format : AC-3 Format/Info : Audio Coding 3 Codec ID : A_AC3 Duration : 1mn 1s Bit rate mode : Constant Bit rate : 448 Kbps Channel(s) : 2 channels Channel positions : L R Sampling rate : 48.0 KHz Audio #2 Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Codec ID : A_MPEG/L2 Codec ID/Hint : MP2 Duration : 1mn 1s Bit rate mode : Constant Bit rate : 256 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Resolution : 16 bits Language : German Audio #3 Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Codec ID : A_MPEG/L2 Codec ID/Hint : MP2 Duration : 1mn 1s Bit rate mode : Constant Bit rate : 128 Kbps Channel(s) : 1 channel Sampling rate : 48.0 KHz Resolution : 16 bits then there's this file where the seek command is total _ineffective_ so the playback is continous without any skipping (but that's probably a different issue) Complete name : /dream/movie/mkv/dfd-jumper-720p_part.mkv Format : Matroska File size : 128 MiB Duration : 1h 28mn Overal bit rate : 203 Kbps Encoded date : UTC 2008-07-23 13:09:38 Writing application : mkvmerge v2.2.0 ('Turn It On Again') built on Mar 4 2008 12:58:26 Writing library : libebml v0.7.7 + libmatroska v0.8.1 Video Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings, CABAC : Yes Format settings, ReFrames : 3 frames Codec ID : V_MPEG4/ISO/AVC Duration : 1h 28mn Nominal bit rate : 5092 Kbps Width : 1280 pixels Height : 720 pixels Display aspect ratio : 16/9 Frame rate : 23.976 fps Colorimetry : 4:2:0 Scan type : Progressive Bits/(Pixel*Frame) : 0.230 Writing library : x264 core 60 r915 14046ae Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=7 / brdo=1 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=14,7 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=5092 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=30000 / vbv_bufsize=30000 / ip_ratio=1.40 / pb_ratio=1.30 / aq=2:1.00 Language : German Audio Format : DTS Format/Info : Digital Theater Systems Codec ID : A_DTS Duration : 1h 28mn Bit rate : 1536 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Surround: L R, LFE Sampling rate : 48.0 KHz Resolution : 24 bits Language : German
Valgrind says it leaks for me too.
(In reply to comment #12) > Valgrind says it leaks for me too. Where?
commit c933933f09c8977fc88449d14f14f4b733cf3274 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Tue Jun 23 12:40:56 2009 +0200 ssaparse: avoid leaking all buffers commit 9600c549380d97f79e7a948a3367962405c93f05 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Tue Jun 23 12:42:33 2009 +0200 matroskademux: avoid leaking buffers Don't leak buffers when resyncing to a keyframe. Avoid leaking buffers when exiting the loop on error conditions. Add some more debug info. Fixes #585911
Not closing yet, this fixes the biggest leaks but I think there are some more.
i can acknowledge that the largest part of the work is done... my little test app doesn't munch up the entire box's ram within a couple of seeks anymore :) thanks wim!