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

Aurelien Jacobs aurel
Tue Aug 16 01:42:29 CEST 2005

On Mon, 15 Aug 2005 23:55:18 +0200 (CEST)
<plaum at ipf.uni-stuttgart.de> wrote:

> 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.

Wouldn't such a patch be cleaner ?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: av_free_static_destructor.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050816/492a238c/attachment.asc>

More information about the ffmpeg-devel mailing list