[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trunk r113947: * image.c: Fix animation cache signature memory leak.
From: |
Paul Eggert |
Subject: |
Re: trunk r113947: * image.c: Fix animation cache signature memory leak. |
Date: |
Mon, 19 Aug 2013 09:56:23 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 |
Lars Magne Ingebrigtsen wrote:
> Or am I misreading this completely?
No, you got it right. I expect that I ran the wrong
executable when I thought I was testing the new code.
My code should have looked like the following, I expect.
The advantage of doing it this way is that it calls
imagemagick_create_cache in just one place, and strcmp
in just one place, and refers to 'animation_cache' in
just one place, and updates cache->update time in just
one place, and overall (to my mind anyway) is easier to
understand than the duplications in the current code.
But it's only a minor improvement.
static struct animation_cache *
imagemagick_get_animation_cache (MagickWand *wand)
{
char *signature = MagickGetImageSignature (wand);
struct animation_cache **pcache = &animation_cache;
imagemagick_prune_animation_cache ();
while (1)
{
struct animation_cache *cache = *pcache;
if (! cache)
{
*pcache = cache = imagemagick_create_cache (signature);
break;
}
if (strcmp (signature, cache->signature) == 0)
{
DestroyString (signature);
break;
}
pcache = &cache->next;
}
cache->update_time = current_emacs_time ();
return cache;
}
By the way, did you know that each animation signature
contains 4 KiB of wasted memory? It's ImageMagick
code that's wasting it. Dunno if that's worth tuning.
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak.,
Paul Eggert <=
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Paul Eggert, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19
- Re: trunk r113947: * image.c: Fix animation cache signature memory leak., Lars Magne Ingebrigtsen, 2013/08/19