Opened 8 years ago
Closed 8 years ago
#5740 closed defect (needs_more_info)
Memory leak on Windows, when unloading FFmpeg dlls
Reported by: | seveneleven | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | leak |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
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.
Change History (4)
comment:1 by , 8 years ago
Keywords: | leak added |
---|---|
Resolution: | → needs_more_info |
Status: | new → closed |
comment:2 by , 8 years ago
Resolution: | needs_more_info |
---|---|
Status: | closed → reopened |
I don't think this is a duplicate (at least not of #3194): This leak occurs by only loading and unloading FFmpeg dlls during runtime. There is nothing else to do, like calling avcodec_*()
functions for example.
Demo.exe
loads Demo.dll
(LoadLibrary("Demo.dll")
), thus loading avcodec-57.dll
etc.
When Demo.dll
gets freed (FreeLibrary()
) immediately thereafter, it will cause the leak.
comment:3 by , 8 years ago
Then please provide the output of a memory debugger as required for every leak report.
comment:4 by , 8 years ago
Resolution: | → needs_more_info |
---|---|
Status: | reopened → closed |
Please reopen this ticket if you can provide the necessary information.
A leak report would need valgrind output (or an equivalent report like DrMemory) but I think this is a duplicate of several tickets including #3194.