#5740: Memory leak on Windows, when unloading FFmpeg dlls
-------------------------------------+-------------------------------------
             Reporter:  seveneleven  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I built a dll (VC++, Win32), that uses FFmpeg for video processing and is
 used by several applications.

 Each time this dll is loaded/freed (using Windows API:
 LoadLibrary/FreeLibrary), it leaks around 20KB (given that, in this way,
 FFmpeg dlls are also loaded/unloaded):

 > 'Demo.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avcodec-57.dll'. Module
 was built without symbols.
 > 'Demo.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avutil-55.dll'. Module
 was built without symbols.
 > 'Demo.exe' (Win32): Loaded 'C:\Windows\SysWOW64\swresample-2.dll'.
 Module was built without symbols.
 > 'Demo.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\avcodec-57.dll'
 > 'Demo.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\swresample-2.dll'
 > 'Demo.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\avutil-55.dll'

 On a Windows 7 Machine, I observed leaks of ~20KB each "load/unload". On
 Windows 10 it ranges from 4KB to 20KB (16KB at the most).

 Except for the latest build, this issue can be reproduced with  3.0.1,
 3.0, 2.8.6, 2.8.3.
 In 0.8.7 it worked fine.

 This is all the 'dll code' to reproduce it.

 {{{
 extern "C"
 {
     #include <libavcodec\avcodec.h>
     #pragma comment(lib, "avcodec.lib")
 }

 void __stdcall proveIssue()
 {
     int v = avcodec_version();
 }
 }}}

 Removing the line with `avcodec_version` would ''fix'' it, because no
 FFmpeg dlls would be linked.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5740>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-trac

Reply via email to