[FFmpeg-user] Memory leaks in ffmpeg 2.2

praks411 praks411 at gmail.com
Fri Mar 28 13:26:55 CET 2014


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.


More information about the ffmpeg-user mailing list