[vlc-devel] commit: macosx: VLCAdditions do not leak memory. (Jean-Paul Saman )

Pierre d'Herbemont pdherbemont at free.fr
Sun Jun 14 22:09:21 CEST 2009


On Sun, Jun 14, 2009 at 11:09 AM, git version control<git at videolan.org> wrote:
> vlc | branch: 1.0-bugfix | Jean-Paul Saman <jpsaman at videolan.org> | Sun Jun 14 12:43:11 2009 +0200| [ccc1a9c255de25dbe616b325c490fa0b64a3b5ae] | committer: Jean-Paul Saman
>
> macosx: VLCAdditions do not leak memory.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ccc1a9c255de25dbe616b325c490fa0b64a3b5ae
> ---
>
>  modules/gui/macosx/misc.m |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
> index 51927d7..ecf4f6c 100644
> --- a/modules/gui/macosx/misc.m
> +++ b/modules/gui/macosx/misc.m
> @@ -102,6 +102,11 @@ static NSMapTable *VLCAdditions_userInfo = nil;
>  - (void)dealloc
>  {
>     NSMapRemove(VLCAdditions_userInfo, self);
> +    NSResetMapTable(VLCAdditions_userInfo);
> +    /* NSCreateMapTable mallocs memory from the default zone ('malloc')
> +     * thus releasing it with free() is save. */
> +    free(VLCAdditions_userInfo);
> +    VLCAdditions_userInfo = nil;
>     [super dealloc];

This is wrong. +load create a NSMap whose lifespan is the entire
program life. There is no point in removing it in -dealloc, and it
would lead to wrong behaviour if NSAnimation object is dealloc-ed
during an other NSAnimation object life.

Please revert. There is no leak here.

Pierre.



More information about the vlc-devel mailing list