[Ffmpeg-devel] [PATCH] Call av_free_static automatically before DLL unload

plaum at ipf.uni-stuttgart.de plaum
Mon Aug 15 23:55:18 CEST 2005

Hi all,

this patch calls av_free_static() automatically, before the module
(statically linked executable or shared lib) gets unloaded.
This prevents a potential memory leak in plugin based applications,
where the right time for calling av_free_static() isn't always known.

valgrind --tool=memcheck --leak-check=yes --show-reachable=yes
displays zero lost bytes (in lavc at least) now.

It utilizes the __attribute__ ((destructor)) mechanism, which is supported
since (at least) gcc-2.95 for all target formats. It has been used in
libquicktime for many years on many platforms without a single problem.
Programs, which call av_free_static() explicitely don't have to be
changed, since multiple calls are harmless.

If any problems arise, I'll look after them.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: lavc_av_free_static.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050815/dc7204e2/attachment.bin>

More information about the ffmpeg-devel mailing list