emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the ImageMagick backend seems to leak memory


From: joakim
Subject: Re: Using the ImageMagick backend seems to leak memory
Date: Tue, 11 Jan 2011 15:38:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

address@hidden writes:

> Tassilo Horn <address@hidden> writes:

Could you try this patch? Seems to help for me

=== modified file 'src/image.c'
*** src/image.c 2011-01-07 22:33:32 +0000
--- src/image.c 2011-01-11 14:30:55 +0000
***************
*** 7566,7571 ****
--- 7566,7572 ----
        if (im_image != NULL)
        {
          image_wand = NewMagickWandFromImage (im_image);
+           DestroyImage(im_image);
          status = MagickTrue;
        }
        else




>
>> Miles Bader <address@hidden> writes:
>>
>>>>> I just noticed that my emacs uses up more than a gigabyte memory.
>>>>> It is because of doc-view with ImageMagick backend.
>>>>> 
>>>> I met same issue.
>>>
>>> My impression is that in general, ImageMagick does not aim at memory
>>> efficiency (that's why I don't want to use its libraries for my own
>>> image I/O needs, event though doing so would be pretty convenient).
>>
>> Well, not being memory efficiency and not giving back memory at all is a
>> minor difference. ;-)
>>
>> I've just opened a doc-view page-x.png with ImageMagick's display tool.
>> The behavior is identical, e.g., it reserves ~30MB per PNG and only
>> gives back memory when I close the program.  So I presume, ImageMagick
>> has some cache that gets at least cleared when the process is killed.
>> I'm sure, there's some C function you can call to clear it...
>>
>> Looking at the API, there's
>>
>> ClearMagickWand() clears resources associated with the wand.
>> The format of the ClearMagickWand method is:
>>
>>   void ClearMagickWand(MagickWand *wand)
>>
>> A description of each parameter follows:
>> wand
>>   the magick wand.
>>
>> In the emacs sources, that function's never called.  So that's probably
>> the source of the leak.
>
> Hmm. We can try.
>
> Anyway i asked the IM team:
> http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=17819
>
> Some other things:
> - Do you see the issue only when scaling?
> - Only with PNG? Or also JPG?
>
>> Bye,
>> Tassilo

-- 
Joakim Verona



reply via email to

[Prev in Thread] Current Thread [Next in Thread]