Memory leaks in ffmpeg 2.2

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Memory leaks in ffmpeg 2.2

praks411
Hi

I'm using ffmpeg in my project for quite sometime. Recently I shifted to ffmpeg 2.2 and I'm seeing memory leaks which were not there earlier. Debugging further I found just by calling  avformat_alloc_context() and then freeing the context using avformat_close_input(). I getting memory leaks of 87bytes. Also if I go further and call avformat_open_input and avformat_find_stream. The memory leaks increases.
These memory leaks are fixed whether I do decoding or not. I'm not sure if these are genuine leaks or do I need to deallocate something more.
Please suggest.

Thanks and Regards,
Pradeep
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

praks411
Hi,

Digging more into the memory leaks. Using Dr.Memory with visual studio 2013, I found following memory leaks
in latest version of ffmpeg 2.2
1. In libavcodec\utils.c in default_lock_mgr related to pthread_mutex_t locking. The mutex is created using malloc but it is not freed when I call avcodec_close(AVCodecCtx*).
2. The second one is in avcodec_decode_video2()

Please let me know if these are real memory leaks or do I need to deallocate these using some other means.

Here is the memory leaks report summary.

 
         Error #79: POSSIBLE LEAK 63 bytes
         replace_malloc
             d:\drmemory_package\common\alloc_replace.c(2292):
         MSVCR120D.dll!_aligned_offset_malloc_dbg
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
         MSVCR120D.dll!_aligned_malloc
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
         ampvideod.dll!av_mallocz  
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(244):
         ampvideod.dll!av_buffer_create
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(34):
         ampvideod.dll!av_buffer_allocz
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(83):
         ampvideod.dll!alloc_picture_tables
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(525):
         ampvideod.dll!ff_alloc_picture
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(609):
         ampvideod.dll!ff_MPV_frame_start
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(1706):
         ampvideod.dll!ff_h263_decode_frame
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\h263dec.c(552):
         ampvideod.dll!avcodec_decode_video2
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2154):
         ampvideod.dll!FfmpegDecoder::DecodeNextFrame
             c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(497):
         
         Error #80: POSSIBLE LEAK 63 direct bytes + 32 indirect bytes
         replace_malloc
             d:\drmemory_package\common\alloc_replace.c(2292):
         MSVCR120D.dll!_aligned_offset_malloc_dbg
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
         MSVCR120D.dll!_aligned_malloc
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
         ampvideod.dll!av_malloc    
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(97):
         ampvideod.dll!default_lockmgr_cb
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(79):
         ampvideod.dll!avpriv_lock_avformat
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(3346):
         ampvideod.dll!VideoDecoderFfmpeg::Init
             c:\users\dev-03\five\src\ampvideo\videodecoderffmpeg.h(25):
         ampvideod.dll!CreateVideoDecoder
             c:\users\dev-03\five\src\ampvideo\videodecoder.cpp(65):
         fivelibd.dll!VideoLoader::FilterConfigurationImpl::CheckParameters
             c:\users\dev-03\five\src\fivelib\exp\videoloader.cpp(167):
         fivecored.dll!Filter::CheckParameters
             c:\users\dev-03\five\src\fivecore\filter.cpp(697):
         fivecored.dll!Filter::Configure
             c:\users\dev-03\five\src\fivecore\filter.cpp(1114):
         fivecored.dll!CommandConfigureFilter::Execute
             c:\users\dev-03\five\src\fivecore\command.cpp(889):

 Error #85: LEAK 51 bytes
         replace_malloc
             d:\drmemory_package\common\alloc_replace.c(2292):
         MSVCR120D.dll!_aligned_offset_malloc_dbg
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
         MSVCR120D.dll!_aligned_malloc
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
         ampvideod.dll!av_mallocz  
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(244):
         ampvideod.dll!av_buffer_ref
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(93):
         ampvideod.dll!av_frame_copy_props
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\frame.c(500):
         ampvideod.dll!unrefcount_frame
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2082):
         ampvideod.dll!avcodec_decode_video2
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2183):
         ampvideod.dll!FfmpegDecoder::DecodeNextFrame
             c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(497):
         ampvideod.dll!FfmpegDecoder::SetFrameId
             c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(639):
         ampvideod.dll!FfmpegDecoder::SetPosition
             c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(425):
         ampvideod.dll!VideoDecoderFfmpeg::SetPosition
             c:\users\dev-03\five\src\ampvideo\videodecoderffmpeg.h(76):
         
         Error #86: POSSIBLE LEAK 63 direct bytes + 32 indirect bytes
         replace_malloc
             d:\drmemory_package\common\alloc_replace.c(2292):
         MSVCR120D.dll!_aligned_offset_malloc_dbg
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
         MSVCR120D.dll!_aligned_malloc
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
         ampvideod.dll!av_malloc    
             c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(97):
         ampvideod.dll!default_lockmgr_cb
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(79):
         ampvideod.dll!ff_lock_avcodec
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(3314):
         ampvideod.dll!avcodec_open2
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(1202):
         ampvideod.dll!avformat_find_stream_info
             c:\users\dev-03\libs32\ffmpeg-2.2\libavformat\utils.c(3063):
         ampvideod.dll!FfmpegDecoder::Init
             c:\users\dev-03\src\ampvideo\ffmpegpp.cpp(213):
         ampvideod.dll!VideoDecoderFfmpeg::Init
             c:\users\dev-03\src\ampvideo\videodecoderffmpeg.h(25):
         ampvideod.dll!CreateVideoDecoder
             c:\users\dev-03\src\ampvideo\videodecoder.cpp(65):
         fivelibd.dll!VideoLoader::FilterConfigurationImpl::CheckParameters
             c:\users\dev-03\src\fivelib\exp\videoloader.cpp(167):
         
         Error #87: POSSIBLE LEAK 397 bytes
         replace_malloc
             d:\drmemory_package\common\alloc_replace.c(2292):
         MSVCR120D.dll!_aligned_offset_malloc_dbg
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
         MSVCR120D.dll!_aligned_malloc
             f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
         ampvideod.dll!av_malloc    
             c:\users\dev-03\libs32\ffmpeg-2.2\libavutil\mem.c(97):
         ampvideod.dll!av_buffer_allocz
             c:\users\dev-03\libs32\ffmpeg-2.2\libavutil\buffer.c(83):
         ampvideod.dll!alloc_picture_tables
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(525):
         ampvideod.dll!ff_alloc_picture
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(609):
         ampvideod.dll!ff_MPV_frame_start
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(1706):
         ampvideod.dll!ff_h263_decode_frame
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\h263dec.c(552):
         ampvideod.dll!avcodec_decode_video2
             c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(2154):
         ampvideod.dll!FfmpegDecoder::DecodeNextFrame
             c:\users\dev-03\ampvideo\ffmpegpp.cpp(497):
         ampvideod.dll!FfmpegDecoder::SetFrameIdNext
             c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(569):
Thanks
Pradeep
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

Carl Eugen Hoyos
In reply to this post by praks411
praks411 <praks411 <at> gmail.com> writes:

> I'm using ffmpeg in my project for quite sometime.
> Recently I shifted to ffmpeg 2.2 and I'm seeing
> memory leaks which were not there earlier. Debugging
> further I found just by calling  avformat_alloc_context()
> and then freeing the context using avformat_close_input().
> I getting memory leaks of 87bytes.

This was discussed at length on ffmpeg-devel, it is
apparently unavoidable if you like dynamic linking.

> Also if I go further and call avformat_open_input and
> avformat_find_stream. The memory leaks increases.

I am not sure if these are the same, valgrind output
would probably help to judge.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

Phil Rhodes
> This was discussed at length on ffmpeg-devel, it is 
> apparently unavoidable if you like dynamic linking.

Could you paraphrase the discussion for those of us who aren't on the list? Because I'm really, really looking forward to an explanation of how dynamic linking inevitably and unavoidably causes memory leaks.

P
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

Naveen Rudrappa
In reply to this post by praks411
Checked this on a linux machine - playing h264 file using valgrind (poor
thing took a while to load video) - there were no memleaks atleast on the
paths mentioned in the libavcodec and libavutil. So it is an issue in your
code (..\dev-03\five\src) - try similar experiment with ffplay on your
windows setup

There are mem leaks in SDL, pulseaudio libs which ffplay relies on my
machine but none in code which is within libav* libs.
Looks like ffplay is doing right calls to both libs in SDL_Init()-ing and
SDL_quit()-ing lib, loading-unloading pulse audio - but may be someone
knows better about these two ?

@Carl: were you inferring this behaviour ?

===========
lib versions on my machine

ffplay version N-61313-g1f36ebf Copyright (c) 2003-2014 the FFmpeg
developers
  built on Mar 27 2014 15:04:28 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --disable-ffmpeg --disable-ffprobe --disable-ffserver
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.100 / 55. 34.100
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100

=============
==8729== 1 bytes in 1 blocks are definitely lost in loss record 1 of 156
==8729==    at 0x4C2CD7B: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8729==    by 0x6983CA5: _XlcDefaultMapModifiers (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x69840C5: XSetLocaleModifiers (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x5373C9B: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5374A20: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5364E2A: SDL_VideoInit (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x533E3AB: SDL_InitSubSystem (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x533E42B: SDL_Init (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x465D58: main (ffplay.c:3636)
==8729==
==8729== 18 bytes in 2 blocks are definitely lost in loss record 13 of 156
==8729==    at 0x4C2CD7B: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8729==    by 0x5D8D971: strdup (strdup.c:42)
==8729==    by 0x6992315: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6993254: _XimSetICValueData (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x698E87D: _XimLocalCreateIC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6974CE2: XCreateIC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x5373AEC: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5374A20: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5364E2A: SDL_VideoInit (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x533E3AB: SDL_InitSubSystem (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x533E42B: SDL_Init (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x465D58: main (ffplay.c:3636)
==8729==
==8729== 72 bytes in 1 blocks are definitely lost in loss record 116 of 156
==8729==    at 0x4C2CD7B: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8729==    by 0x6713716: pa_xmalloc (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x66FFD79: ??? (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x6708379: pa_stream_update_timing_info (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x670866D: ??? (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x6709342: ??? (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x71702C5: ??? (in /usr/lib/x86_64-linux-gnu/pulseaudio/
libpulsecommon-3.0.so)
==8729==    by 0x717064A: pa_pdispatch_run (in
/usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-3.0.so)
==8729==    by 0x66EBCCC: ??? (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x71745CB: ??? (in /usr/lib/x86_64-linux-gnu/pulseaudio/
libpulsecommon-3.0.so)
==8729==    by 0x66FF4C3: pa_mainloop_dispatch (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==    by 0x66FF874: pa_mainloop_iterate (in
/usr/lib/x86_64-linux-gnu/libpulse.so.0.15.3)
==8729==
==8729== 192 (16 direct, 176 indirect) bytes in 1 blocks are definitely
lost in loss record 131 of 156
==8729==    at 0x4C2CF8E: realloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8729==    by 0x697A7BE: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697AC7B: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697C474: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697CC35: _XlcCreateLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x69993EF: _XlcDefaultLoader (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6983EFD: _XOpenLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6984047: _XlcCurrentLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x698409D: XSetLocaleModifiers (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x5373C4B: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5374A20: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5364E2A: SDL_VideoInit (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==
==8729== 1,688 (136 direct, 1,552 indirect) bytes in 1 blocks are
definitely lost in loss record 144 of 156
==8729==    at 0x4C2CF8E: realloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8729==    by 0x697A7BE: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697AC7B: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697C474: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x697CC35: _XlcCreateLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x699D37F: _XlcUtf8Loader (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6983EFD: _XOpenLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x6984047: _XlcCurrentLC (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x698409D: XSetLocaleModifiers (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==8729==    by 0x5373C9B: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5374A20: ??? (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==8729==    by 0x5364E2A: SDL_VideoInit (in
/usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)



On Fri, Mar 28, 2014 at 12:26 PM, praks411 <[hidden email]> wrote:

> Hi,
>
> Digging more into the memory leaks. Using Dr.Memory with visual studio
> 2013,
> I found following memory leaks
> in latest version of ffmpeg 2.2
> 1. In libavcodec\utils.c in default_lock_mgr related to pthread_mutex_t
> locking. The mutex is created using malloc but it is not freed when I call
> avcodec_close(AVCodecCtx*).
> 2. The second one is in avcodec_decode_video2()
>
> Please let me know if these are real memory leaks or do I need to
> deallocate
> these using some other means.
>
> Here is the memory leaks report summary.
>
>
>          Error #79: POSSIBLE LEAK 63 bytes
>          replace_malloc
>              d:\drmemory_package\common\alloc_replace.c(2292):
>          MSVCR120D.dll!_aligned_offset_malloc_dbg
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
>          MSVCR120D.dll!_aligned_malloc
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
>          ampvideod.dll!av_mallocz
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(244):
>          ampvideod.dll!av_buffer_create
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(34):
>          ampvideod.dll!av_buffer_allocz
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(83):
>          ampvideod.dll!alloc_picture_tables
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(525):
>          ampvideod.dll!ff_alloc_picture
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(609):
>          ampvideod.dll!ff_MPV_frame_start
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(1706):
>          ampvideod.dll!ff_h263_decode_frame
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\h263dec.c(552):
>          ampvideod.dll!avcodec_decode_video2
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2154):
>          ampvideod.dll!FfmpegDecoder::DecodeNextFrame
>              c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(497):
>
>          Error #80: POSSIBLE LEAK 63 direct bytes + 32 indirect bytes
>          replace_malloc
>              d:\drmemory_package\common\alloc_replace.c(2292):
>          MSVCR120D.dll!_aligned_offset_malloc_dbg
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
>          MSVCR120D.dll!_aligned_malloc
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
>          ampvideod.dll!av_malloc
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(97):
>          ampvideod.dll!default_lockmgr_cb
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(79):
>          ampvideod.dll!avpriv_lock_avformat
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(3346):
>          ampvideod.dll!VideoDecoderFfmpeg::Init
>              c:\users\dev-03\five\src\ampvideo\videodecoderffmpeg.h(25):
>          ampvideod.dll!CreateVideoDecoder
>              c:\users\dev-03\five\src\ampvideo\videodecoder.cpp(65):
>          fivelibd.dll!VideoLoader::FilterConfigurationImpl::CheckParameters
>              c:\users\dev-03\five\src\fivelib\exp\videoloader.cpp(167):
>          fivecored.dll!Filter::CheckParameters
>              c:\users\dev-03\five\src\fivecore\filter.cpp(697):
>          fivecored.dll!Filter::Configure
>              c:\users\dev-03\five\src\fivecore\filter.cpp(1114):
>          fivecored.dll!CommandConfigureFilter::Execute
>              c:\users\dev-03\five\src\fivecore\command.cpp(889):
>
>  Error #85: LEAK 51 bytes
>          replace_malloc
>              d:\drmemory_package\common\alloc_replace.c(2292):
>          MSVCR120D.dll!_aligned_offset_malloc_dbg
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
>          MSVCR120D.dll!_aligned_malloc
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
>          ampvideod.dll!av_mallocz
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(244):
>          ampvideod.dll!av_buffer_ref
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\buffer.c(93):
>          ampvideod.dll!av_frame_copy_props
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\frame.c(500):
>          ampvideod.dll!unrefcount_frame
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2082):
>          ampvideod.dll!avcodec_decode_video2
>
> c:\users\dev-03\five\libs32\ffmpeg-2.2\libavcodec\utils.c(2183):
>          ampvideod.dll!FfmpegDecoder::DecodeNextFrame
>              c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(497):
>          ampvideod.dll!FfmpegDecoder::SetFrameId
>              c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(639):
>          ampvideod.dll!FfmpegDecoder::SetPosition
>              c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(425):
>          ampvideod.dll!VideoDecoderFfmpeg::SetPosition
>              c:\users\dev-03\five\src\ampvideo\videodecoderffmpeg.h(76):
>
>          Error #86: POSSIBLE LEAK 63 direct bytes + 32 indirect bytes
>          replace_malloc
>              d:\drmemory_package\common\alloc_replace.c(2292):
>          MSVCR120D.dll!_aligned_offset_malloc_dbg
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
>          MSVCR120D.dll!_aligned_malloc
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
>          ampvideod.dll!av_malloc
>              c:\users\dev-03\five\libs32\ffmpeg-2.2\libavutil\mem.c(97):
>          ampvideod.dll!default_lockmgr_cb
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(79):
>          ampvideod.dll!ff_lock_avcodec
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(3314):
>          ampvideod.dll!avcodec_open2
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(1202):
>          ampvideod.dll!avformat_find_stream_info
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavformat\utils.c(3063):
>          ampvideod.dll!FfmpegDecoder::Init
>              c:\users\dev-03\src\ampvideo\ffmpegpp.cpp(213):
>          ampvideod.dll!VideoDecoderFfmpeg::Init
>              c:\users\dev-03\src\ampvideo\videodecoderffmpeg.h(25):
>          ampvideod.dll!CreateVideoDecoder
>              c:\users\dev-03\src\ampvideo\videodecoder.cpp(65):
>          fivelibd.dll!VideoLoader::FilterConfigurationImpl::CheckParameters
>              c:\users\dev-03\src\fivelib\exp\videoloader.cpp(167):
>
>          Error #87: POSSIBLE LEAK 397 bytes
>          replace_malloc
>              d:\drmemory_package\common\alloc_replace.c(2292):
>          MSVCR120D.dll!_aligned_offset_malloc_dbg
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2891):
>          MSVCR120D.dll!_aligned_malloc
>              f:\dd\vctools\crt\crtw32\misc\dbgheap.c(2621):
>          ampvideod.dll!av_malloc
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavutil\mem.c(97):
>          ampvideod.dll!av_buffer_allocz
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavutil\buffer.c(83):
>          ampvideod.dll!alloc_picture_tables
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(525):
>          ampvideod.dll!ff_alloc_picture
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(609):
>          ampvideod.dll!ff_MPV_frame_start
>
>  c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\mpegvideo.c(1706):
>          ampvideod.dll!ff_h263_decode_frame
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\h263dec.c(552):
>          ampvideod.dll!avcodec_decode_video2
>              c:\users\dev-03\libs32\ffmpeg-2.2\libavcodec\utils.c(2154):
>          ampvideod.dll!FfmpegDecoder::DecodeNextFrame
>              c:\users\dev-03\ampvideo\ffmpegpp.cpp(497):
>          ampvideod.dll!FfmpegDecoder::SetFrameIdNext
>              c:\users\dev-03\five\src\ampvideo\ffmpegpp.cpp(569):
> Thanks
> Pradeep
>
>
>
> --
> View this message in context:
> http://ffmpeg-users.933282.n4.nabble.com/Memory-leaks-in-ffmpeg-2-2-tp4664505p4664518.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



--
,
Naveen Rudrappa
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

Carl Eugen Hoyos
Naveen Rudrappa <naveen.mr <at> gmail.com> writes:

>  <at> Carl: were you inferring this behaviour ?

No.
Testing with sdl/ffplay is usually not a good idea,
you find many bugs in sdl;-(
(Or at least memleaks that have nothing to do with
FFmpeg.)

This is about a global lock that libavcodec needs
to avoid race conditions, releasing the lock would
introduce another race condition (only for dynamic
libraries iirc).

Please do not top-post here, Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Memory leaks in ffmpeg 2.2

praks411
Thanks for the suggestions. Currently my whole setup is on windows so it is difficult to get valgrind running from me. The lock condition which you have mentioned is true, as I was able to verify it by explicitly releasing the lock, the memory leaks were gone but there were some other issues, the code was crashing possibly due to another race conditions.

Pradeep